diff --git a/.gitignore b/.gitignore index febe9fb..63ce2ee 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ client/main bin/ tmp -.mcp.json \ No newline at end of file +.mcp.json +.claude \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md index 5a003c2..fd775e0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -44,6 +44,7 @@ Keep `server/server.go` thin. New protocol logic normally belongs in `cnode`, `h - Boolean end-to-end payments should not require relay-side on-chain actions. Numeric payments may require registry checks or disputes only where the protocol already allows them. - Channel and payment mutations that belong to one protocol step should stay inside the existing `storage.DAL` transaction boundaries. - Multi-server mode changes must preserve client ownership and forwarding behavior in `cnode/multiserver.go`. +- All on-chain deadlines / challenge windows / timeouts are unix seconds — the contracts compare against `block.timestamp`, not `block.number`. Off-chain code uses `time.Now().Unix()` to produce and check them. This applies to `disputeTimeout`, `settleFinalizedTime`, `withdrawDeadline`, `openDeadline`, `resolveDeadline`, `resolveTimeout`, `migrationDeadline`, the `RouterRegistry` register/refresh value, and per-pay deadlines in `PayRegistry`. ## Conventions diff --git a/app/app.pb.go b/app/app.pb.go deleted file mode 100644 index 4ed17b4..0000000 --- a/app/app.pb.go +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright 2018-2025 Celer Network - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.6 -// protoc v6.33.2 -// source: app.proto - -package app - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - descriptorpb "google.golang.org/protobuf/types/descriptorpb" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Next Tag: 5 -type AppState struct { - state protoimpl.MessageState `protogen:"open.v1"` - // nonce should be unique for each app session among the same signers - Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` - // for each nonce, new state has higher sequence number - SeqNum uint64 `protobuf:"varint,2,opt,name=seq_num,json=seqNum,proto3" json:"seq_num,omitempty"` - // app specific state - State []byte `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` - // on-chain response (settle, action) timeout - Timeout uint64 `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AppState) Reset() { - *x = AppState{} - mi := &file_app_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AppState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppState) ProtoMessage() {} - -func (x *AppState) ProtoReflect() protoreflect.Message { - mi := &file_app_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AppState.ProtoReflect.Descriptor instead. -func (*AppState) Descriptor() ([]byte, []int) { - return file_app_proto_rawDescGZIP(), []int{0} -} - -func (x *AppState) GetNonce() uint64 { - if x != nil { - return x.Nonce - } - return 0 -} - -func (x *AppState) GetSeqNum() uint64 { - if x != nil { - return x.SeqNum - } - return 0 -} - -func (x *AppState) GetState() []byte { - if x != nil { - return x.State - } - return nil -} - -func (x *AppState) GetTimeout() uint64 { - if x != nil { - return x.Timeout - } - return 0 -} - -// Next Tag: 3 -type StateProof struct { - state protoimpl.MessageState `protogen:"open.v1"` - // serialized AppState - AppState []byte `protobuf:"bytes,1,opt,name=app_state,json=appState,proto3" json:"app_state,omitempty"` - Sigs [][]byte `protobuf:"bytes,2,rep,name=sigs,proto3" json:"sigs,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StateProof) Reset() { - *x = StateProof{} - mi := &file_app_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StateProof) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StateProof) ProtoMessage() {} - -func (x *StateProof) ProtoReflect() protoreflect.Message { - mi := &file_app_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StateProof.ProtoReflect.Descriptor instead. -func (*StateProof) Descriptor() ([]byte, []int) { - return file_app_proto_rawDescGZIP(), []int{1} -} - -func (x *StateProof) GetAppState() []byte { - if x != nil { - return x.AppState - } - return nil -} - -func (x *StateProof) GetSigs() [][]byte { - if x != nil { - return x.Sigs - } - return nil -} - -// used for multi-session app -// Next Tag: 3 -type SessionQuery struct { - state protoimpl.MessageState `protogen:"open.v1"` - // session ID - Session []byte `protobuf:"bytes,1,opt,name=session,proto3" json:"session,omitempty"` - // query related to the specified session - Query []byte `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SessionQuery) Reset() { - *x = SessionQuery{} - mi := &file_app_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SessionQuery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SessionQuery) ProtoMessage() {} - -func (x *SessionQuery) ProtoReflect() protoreflect.Message { - mi := &file_app_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SessionQuery.ProtoReflect.Descriptor instead. -func (*SessionQuery) Descriptor() ([]byte, []int) { - return file_app_proto_rawDescGZIP(), []int{2} -} - -func (x *SessionQuery) GetSession() []byte { - if x != nil { - return x.Session - } - return nil -} - -func (x *SessionQuery) GetQuery() []byte { - if x != nil { - return x.Query - } - return nil -} - -var file_app_proto_extTypes = []protoimpl.ExtensionInfo{ - { - ExtendedType: (*descriptorpb.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 1003, - Name: "app.soltype", - Tag: "bytes,1003,opt,name=soltype", - Filename: "app.proto", - }, -} - -// Extension fields to descriptorpb.FieldOptions. -var ( - // optional string soltype = 1003; - E_Soltype = &file_app_proto_extTypes[0] -) - -var File_app_proto protoreflect.FileDescriptor - -const file_app_proto_rawDesc = "" + - "\n" + - "\tapp.proto\x12\x03app\x1a google/protobuf/descriptor.proto\"\x84\x01\n" + - "\bAppState\x12\x1d\n" + - "\x05nonce\x18\x01 \x01(\x04B\a\xda>\x04uintR\x05nonce\x12 \n" + - "\aseq_num\x18\x02 \x01(\x04B\a\xda>\x04uintR\x06seqNum\x12\x14\n" + - "\x05state\x18\x03 \x01(\fR\x05state\x12!\n" + - "\atimeout\x18\x04 \x01(\x04B\a\xda>\x04uintR\atimeout\"=\n" + - "\n" + - "StateProof\x12\x1b\n" + - "\tapp_state\x18\x01 \x01(\fR\bappState\x12\x12\n" + - "\x04sigs\x18\x02 \x03(\fR\x04sigs\"J\n" + - "\fSessionQuery\x12$\n" + - "\asession\x18\x01 \x01(\fB\n" + - "\xda>\abytes32R\asession\x12\x14\n" + - "\x05query\x18\x02 \x01(\fR\x05query:8\n" + - "\asoltype\x12\x1d.google.protobuf.FieldOptions\x18\xeb\a \x01(\tR\asoltypeB(Z&github.com/celer-network/agent-pay/appb\x06proto3" - -var ( - file_app_proto_rawDescOnce sync.Once - file_app_proto_rawDescData []byte -) - -func file_app_proto_rawDescGZIP() []byte { - file_app_proto_rawDescOnce.Do(func() { - file_app_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_app_proto_rawDesc), len(file_app_proto_rawDesc))) - }) - return file_app_proto_rawDescData -} - -var file_app_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_app_proto_goTypes = []any{ - (*AppState)(nil), // 0: app.AppState - (*StateProof)(nil), // 1: app.StateProof - (*SessionQuery)(nil), // 2: app.SessionQuery - (*descriptorpb.FieldOptions)(nil), // 3: google.protobuf.FieldOptions -} -var file_app_proto_depIdxs = []int32{ - 3, // 0: app.soltype:extendee -> google.protobuf.FieldOptions - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 0, // [0:1] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_app_proto_init() } -func file_app_proto_init() { - if File_app_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_app_proto_rawDesc), len(file_app_proto_rawDesc)), - NumEnums: 0, - NumMessages: 3, - NumExtensions: 1, - NumServices: 0, - }, - GoTypes: file_app_proto_goTypes, - DependencyIndexes: file_app_proto_depIdxs, - MessageInfos: file_app_proto_msgTypes, - ExtensionInfos: file_app_proto_extTypes, - }.Build() - File_app_proto = out.File - file_app_proto_goTypes = nil - file_app_proto_depIdxs = nil -} diff --git a/app/appclient.go b/app/appclient.go index d98326c..dcf6522 100644 --- a/app/appclient.go +++ b/app/appclient.go @@ -1,135 +1,70 @@ // Copyright 2018-2025 Celer Network +// Bindings for the `IBooleanCond` condition-contract interface plus +// `AppClient` — registration of `VIRTUAL_CONTRACT` bytecode, lazy on-chain +// deployment via `VirtContractResolver`, and off-chain +// `IBooleanCond.{isFinalized,getOutcome}` query. +// +// `app/booleancond.go` is regenerated by tools/scripts/regenerate-go-bindings.sh +// from `agent-pay-contracts/src/lib/interface/IBooleanCond.sol`. Don't edit it +// by hand — changes get blown away on the next regen. + package app import ( - "bytes" - "errors" "fmt" "math/big" "sync" - "github.com/celer-network/agent-pay/chain" "github.com/celer-network/agent-pay/chain/channel-eth-go/virtresolver" "github.com/celer-network/agent-pay/common" - "github.com/celer-network/agent-pay/common/event" - "github.com/celer-network/agent-pay/common/intfs" "github.com/celer-network/agent-pay/config" "github.com/celer-network/agent-pay/ctype" - "github.com/celer-network/agent-pay/entity" - "github.com/celer-network/agent-pay/storage" "github.com/celer-network/agent-pay/utils" "github.com/celer-network/goutils/eth" - "github.com/celer-network/goutils/eth/monitor" "github.com/celer-network/goutils/log" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "google.golang.org/protobuf/proto" ) +// AppChannel tracks a registered VIRTUAL_CONTRACT condition contract: the +// bytecode + constructor + nonce that determine its deterministic address, and +// (after the first deploy-on-query) the on-chain deployed address. All fields +// are unexported so external readers go through `AppClient` methods, which +// take `mu` to serialize the read-decide-write window in `deployIfNeeded`. +// +// `mu` serializes deploy-on-query so concurrent callers can't both submit +// deploy transactions for the same channel. It is held across the on-chain +// deploy submission in `deployIfNeeded`; concurrent gRPC requests for the +// same cid serialize for ~one block time on the first query and pass +// straight through afterward. `IBooleanCond.IsFinalized` / `GetOutcome` in +// `GetBooleanOutcome` are called outside the lock so post-deploy reads do +// not block on each other. type AppChannel struct { - Type entity.ConditionType - Nonce uint64 - ByteCode []byte // only for virtual contract - Constructor []byte // only for virtual contract - Players []ctype.Addr // only for deployed contract - Session [32]byte // only for deployed contract - DeployedAddr ctype.Addr - OnChainTimeout uint64 - Callback common.StateCallback - mu sync.Mutex - client *AppClient - cid string - callbackID monitor.CallbackID + nonce uint64 + byteCode []byte + constructor []byte + deployedAddr ctype.Addr + mu sync.Mutex } type AppClient struct { nodeConfig common.GlobalNodeConfig - transactor *eth.Transactor transactorPool *eth.TransactorPool - monitorService intfs.MonitorService - dal *storage.DAL - signer eth.Signer appChannels map[string]*AppChannel cLock sync.RWMutex - - virtDeployMu sync.Mutex - virtDeployWatchStarted bool - virtDeployWatchID monitor.CallbackID - virtDeployChanCount int } func NewAppClient( nodeConfig common.GlobalNodeConfig, - transactor *eth.Transactor, transactorPool *eth.TransactorPool, - monitorService intfs.MonitorService, - dal *storage.DAL, - signer eth.Signer, ) *AppClient { - p := &AppClient{ + return &AppClient{ nodeConfig: nodeConfig, - transactor: transactor, transactorPool: transactorPool, - monitorService: monitorService, - dal: dal, - signer: signer, appChannels: make(map[string]*AppChannel), } - return p -} - -func (a *AppChannel) setDeployedAddr(addr ctype.Addr) { - a.mu.Lock() - defer a.mu.Unlock() - a.DeployedAddr = addr -} - -func (a *AppChannel) getDeployedAddr() ctype.Addr { - a.mu.Lock() - defer a.mu.Unlock() - return a.DeployedAddr -} - -// onVirtualContractDeploy triggers OnDispute callback for an app based on a virtual contract -// when the contract is deployed -func (a *AppChannel) onVirtualContractDeploy(eLog *types.Log) (bool, error) { - e := &virtresolver.VirtContractResolverDeploy{} - virtResolver := a.client.nodeConfig.GetVirtResolverContract().(*chain.BoundContract) - err := virtResolver.ParseEvent(event.Deploy, *eLog, e) - if err != nil { - log.Error(err) - return false, err - } - if ctype.Bytes2Hex(e.VirtAddr[:]) == a.cid { - a.Callback.OnDispute(0) // seqNum = 0 implies the virtual contract is deployed - return true, nil - } - return false, nil -} - -// onDeployedContractSettle triggers OnDispute callback for an app based on a deployed multisession -// contract when the session is created on chain by IntendSettle -func (a *AppChannel) onDeployedContractSettle(eLog *types.Log) (bool, error) { - e := &IMultiSessionIntendSettle{} - deployedAdr := a.getDeployedAddr() - contract, err := chain.NewBoundContract( - a.client.nodeConfig.GetEthConn(), deployedAdr, IMultiSessionABI) - if err != nil { - log.Error(err) - return false, err - } - err = contract.ParseEvent(event.IntendSettle, *eLog, e) - if err != nil { - log.Error(err) - return false, err - } - if bytes.Equal(a.Session[:], e.Session[:]) { - a.Callback.OnDispute(int(e.Seq.Int64())) - return true, nil - } - return false, nil } func (c *AppClient) PutAppChannel(cid string, appChannel *AppChannel) { @@ -144,201 +79,50 @@ func (c *AppClient) GetAppChannel(cid string) *AppChannel { return c.appChannels[cid] } +// DeleteAppChannel removes the in-memory bookkeeping for a registered virtual +// condition contract. It does not touch any on-chain state. func (c *AppClient) DeleteAppChannel(cid string) { c.cLock.Lock() - appChannel := c.appChannels[cid] - if appChannel != nil { - delete(c.appChannels, cid) - } + delete(c.appChannels, cid) c.cLock.Unlock() - - if appChannel == nil { - return - } - - switch appChannel.Type { - case entity.ConditionType_VIRTUAL_CONTRACT: - c.virtDeployMu.Lock() - if c.virtDeployChanCount > 0 { - c.virtDeployChanCount-- - } - watchID := c.virtDeployWatchID - shouldStop := c.virtDeployChanCount == 0 && c.virtDeployWatchStarted - if shouldStop { - c.virtDeployWatchStarted = false - c.virtDeployWatchID = 0 - } - c.virtDeployMu.Unlock() - if shouldStop && watchID != 0 { - c.monitorService.RemoveEvent(watchID) - } - default: - if appChannel.callbackID != 0 { - c.monitorService.RemoveEvent(appChannel.callbackID) - } - } -} - -func (c *AppClient) registerVirtResolverDeployWatch() error { - c.virtDeployMu.Lock() - defer c.virtDeployMu.Unlock() - - c.virtDeployChanCount++ - - if c.virtDeployWatchStarted { - return nil - } - - monitorCfg := &monitor.Config{ - ChainId: config.ChainId.Uint64(), - EventName: event.Deploy, - Contract: c.nodeConfig.GetVirtResolverContract(), - StartBlock: c.monitorService.GetCurrentBlockNumber(), - } - if config.QuickCatchBlockDelay < config.BlockDelay { - monitorCfg.BlockDelay = config.QuickCatchBlockDelay - } - - watchID, err := c.monitorService.Monitor(monitorCfg, func(id monitor.CallbackID, eLog types.Log) bool { - e := &virtresolver.VirtContractResolverDeploy{} - virtResolver, ok := c.nodeConfig.GetVirtResolverContract().(*chain.BoundContract) - if !ok { - log.Error("VirtResolver contract is not a BoundContract") - return false - } - if err := virtResolver.ParseEvent(event.Deploy, eLog, e); err != nil { - log.Error(err) - return false - } - - cid := ctype.Bytes2Hex(e.VirtAddr[:]) - appChannel := c.GetAppChannel(cid) - if appChannel == nil || appChannel.Type != entity.ConditionType_VIRTUAL_CONTRACT || appChannel.Callback == nil { - return false - } - appChannel.Callback.OnDispute(0) // seqNum = 0 implies the virtual contract is deployed - return false - }) - if err != nil { - c.virtDeployChanCount-- - return err - } - - c.virtDeployWatchStarted = true - c.virtDeployWatchID = watchID - return nil } +// NewAppChannelOnVirtualContract registers a VIRTUAL_CONTRACT condition +// contract. The cnode stores the bytecode + constructor + nonce so that, when +// dispute resolution requires it, the contract can be deployed on-chain and +// queried via `IBooleanCond.{isFinalized,getOutcome}`. Returns the deterministic +// virtual-contract address (hex) used as the session id / `OnChainAddress` in +// `Condition` payloads. func (c *AppClient) NewAppChannelOnVirtualContract( byteCode []byte, constructor []byte, - nonce uint64, - onchainTimeout uint64, - sc common.StateCallback) (string, error) { + nonce uint64) (string, error) { cid := ctype.Bytes2Hex(GetVirtualAddress(byteCode, constructor, nonce)) appChannel := &AppChannel{ - Type: entity.ConditionType_VIRTUAL_CONTRACT, - Nonce: nonce, - ByteCode: byteCode, - Constructor: constructor, - DeployedAddr: ctype.ZeroAddr, - OnChainTimeout: onchainTimeout, - Callback: sc, - client: c, - cid: cid, + nonce: nonce, + byteCode: byteCode, + constructor: constructor, + deployedAddr: ctype.ZeroAddr, } c.PutAppChannel(cid, appChannel) - - if err := c.registerVirtResolverDeployWatch(); err != nil { - log.Error(err) - c.DeleteAppChannel(cid) - return cid, err - } return cid, nil } -func (c *AppClient) NewAppChannelOnDeployedContract( - contractAddr ctype.Addr, - nonce uint64, - players []ctype.Addr, - onchainTimeout uint64, - sc common.StateCallback) (string, error) { - - players = SortPlayers(players) - session, err := c.getSessionID(contractAddr, nonce, players) - if err != nil { - return "", err - } - cid := ctype.Bytes2Hex(session[:]) - appChannel := &AppChannel{ - Type: entity.ConditionType_DEPLOYED_CONTRACT, - Nonce: nonce, - Players: players, - Session: session, - DeployedAddr: contractAddr, - OnChainTimeout: onchainTimeout, - Callback: sc, - client: c, - cid: cid, - } - c.PutAppChannel(cid, appChannel) - - contract, err := chain.NewBoundContract( - c.nodeConfig.GetEthConn(), contractAddr, IMultiSessionABI) - if err != nil { - log.Error(err) - return cid, err - } - monitorCfg := &monitor.Config{ - ChainId: config.ChainId.Uint64(), - EventName: event.IntendSettle, - Contract: contract, - StartBlock: c.monitorService.GetCurrentBlockNumber(), - } - if config.QuickCatchBlockDelay < config.BlockDelay { - monitorCfg.BlockDelay = config.QuickCatchBlockDelay - } - callbackID, err := c.monitorService.Monitor(monitorCfg, - func(id monitor.CallbackID, eLog types.Log) bool { - hit, _ := appChannel.onDeployedContractSettle(&eLog) - if hit { - c.monitorService.RemoveEvent(id) - } - return false - }) - if err != nil { - log.Error(err) - } - appChannel.callbackID = callbackID - return cid, err -} - -func (c *AppClient) SettleAppChannel(cid string, stateproof []byte) error { - log.Infoln("Settle app channel", cid) - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return fmt.Errorf("SettleAppChannel error: app channel not found") - } - - if err := c.deployIfNeeded(appChannel); err != nil { - return err - } - - err := c.intendSettle(appChannel, stateproof) - return err -} - +// GetAppChannelDeployedAddr returns the on-chain deployed address of a +// registered virtual condition contract. If the contract has not been deployed +// yet, it probes the virt-resolver registry; returns an error if not deployed. func (c *AppClient) GetAppChannelDeployedAddr(cid string) (ctype.Addr, error) { appChannel := c.GetAppChannel(cid) if appChannel == nil { return ctype.ZeroAddr, fmt.Errorf("app channel not found") } - addr := appChannel.getDeployedAddr() - if addr != (ctype.ZeroAddr) || appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - return addr, nil + appChannel.mu.Lock() + defer appChannel.mu.Unlock() + if appChannel.deployedAddr != ctype.ZeroAddr { + return appChannel.deployedAddr, nil } - virtAddr := GetVirtualAddress(appChannel.ByteCode, appChannel.Constructor, appChannel.Nonce) + virtAddr := GetVirtualAddress(appChannel.byteCode, appChannel.constructor, appChannel.nonce) deployed, addr, err := c.isDeployed(virtAddr) if err != nil { return addr, err @@ -346,492 +130,58 @@ func (c *AppClient) GetAppChannelDeployedAddr(cid string) (ctype.Addr, error) { if !deployed { return ctype.ZeroAddr, fmt.Errorf("virtual contract not deployed") } - appChannel.setDeployedAddr(addr) + appChannel.deployedAddr = addr return addr, nil } -// GetBooleanOutcome returns contract isFinalized and getOutcome +// GetBooleanOutcome queries `IBooleanCond.{isFinalized,getOutcome}` for the +// registered condition contract, triggering deploy-on-query if the virtual +// contract has not been deployed yet. The query bytes are passed through +// unchanged (matches what `PayResolver` does on-chain) — no `SessionQuery` +// wrapping. func (c *AppClient) GetBooleanOutcome(cid string, query []byte) (bool, bool, error) { - finalized := false - result := false appChannel := c.GetAppChannel(cid) if appChannel == nil { return false, false, fmt.Errorf("GetBooleanOutcome error: app channel not found") } - if err := c.deployIfNeeded(appChannel); err != nil { + deployedAddr, err := c.deployIfNeeded(appChannel) + if err != nil { return false, false, err } - deployedAddr := appChannel.getDeployedAddr() - contract, err := NewIBooleanOutcomeCaller( - deployedAddr, c.transactorPool.ContractCaller()) + contract, err := NewIBooleanCondCaller(deployedAddr, c.transactorPool.ContractCaller()) if err != nil { return false, false, fmt.Errorf("GetBooleanOutcome error: %w", err) } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - finalized, err = contract.IsFinalized(&bind.CallOpts{}, nil) - if err != nil { - return false, false, fmt.Errorf("contract IsFinalized error: %w", err) - } - result, err = contract.GetOutcome(&bind.CallOpts{}, query) - if err != nil { - return false, false, fmt.Errorf("contract GetResult error: %w", err) - } - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - finalized, err = contract.IsFinalized(&bind.CallOpts{}, appChannel.Session[:]) - if err != nil { - return false, false, fmt.Errorf("contract IsFinalized error: %w", err) - } - sessionQuery := &SessionQuery{ - Session: appChannel.Session[:], - Query: query, - } - seralizedSessionQuery, err2 := proto.Marshal(sessionQuery) - if err2 != nil { - return false, false, fmt.Errorf("contract GetResult error: %w", err2) - } - result, err = contract.GetOutcome(&bind.CallOpts{}, seralizedSessionQuery) - } - return finalized, result, err -} - -func (c *AppClient) ApplyAction(cid string, action []byte) error { - log.Infoln("Apply action to app channel", cid) - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return fmt.Errorf("ApplyAction error: app channel not found") - } - - receipt, err := c.transactor.TransactWaitMined( - "ApplyAction", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - if addr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("FinalizeOnActionTimeout error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err2 := NewISingleSessionTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.ApplyAction(opts, action) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err2 := NewIMultiSessionTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.ApplyAction(opts, appChannel.Session, action) - } - return nil, errors.New("ApplyAction failed: invalid app channel type") - }, - config.QuickTransactOptions()...) - if err != nil { - log.Error(err) - return err - } - if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("ApplyAction transaction %x failed", receipt.TxHash) - } - return nil -} - -func (c *AppClient) FinalizeAppChannelOnActionTimeout(cid string) error { - log.Infoln("Finalize on action timeout on app channel", cid) - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return fmt.Errorf("FinalizeOnActionTimeout error: app channel not found") - } - - receipt, err := c.transactor.TransactWaitMined( - "FinalizeOnActionTimeout", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - if addr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("FinalizeOnActionTimeout error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err2 := NewISingleSessionTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.FinalizeOnActionTimeout(opts) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err2 := NewIMultiSessionTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.FinalizeOnActionTimeout(opts, appChannel.Session) - } - return nil, errors.New("FinalizeOnActionTimeout failed: invalid app channel type") - }, - config.QuickTransactOptions()...) - if err != nil { - log.Error(err) - return err - } - if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("FinalizeOnActionTimeout transaction %x failed", receipt.TxHash) - } - return nil -} - -func (c *AppClient) GetAppChannelSettleFinalizedTime(cid string) (uint64, error) { - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return 0, fmt.Errorf("GetSettleFinalizedTime error: app channel not found") - } - deployedAddr := appChannel.getDeployedAddr() - if deployedAddr == (ctype.ZeroAddr) { - return 0, fmt.Errorf("GetSettleFinalizedTime error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err := NewISingleSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - blkNum, err := contract.GetSettleFinalizedTime(&bind.CallOpts{}) - if err != nil { - return 0, err - } - if blkNum == nil { - return 0, fmt.Errorf("GetActionDeadline failed, nil blkNum") - } - return blkNum.Uint64(), nil - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err := NewIMultiSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - blkNum, err := contract.GetSettleFinalizedTime(&bind.CallOpts{}, appChannel.Session) - if err != nil { - return 0, err - } - if blkNum == nil { - return 0, fmt.Errorf("GetActionDeadline failed, nil blkNum") - } - return blkNum.Uint64(), nil - } - return 0, errors.New("GetSettleFinalizedTime failed: invalid app channel type") -} - -func (c *AppClient) GetAppChannelActionDeadline(cid string) (uint64, error) { - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return 0, fmt.Errorf("GetActionDeadline error: app channel not found") - } - deployedAddr := appChannel.getDeployedAddr() - if deployedAddr == (ctype.ZeroAddr) { - return 0, fmt.Errorf("GetActionDeadline error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err := NewISingleSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - blkNum, err := contract.GetActionDeadline(&bind.CallOpts{}) - if err != nil { - return 0, err - } - if blkNum == nil { - return 0, fmt.Errorf("GetActionDeadline failed, nil blkNum") - } - return blkNum.Uint64(), nil - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err := NewIMultiSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - blkNum, err := contract.GetActionDeadline(&bind.CallOpts{}, appChannel.Session) - if err != nil { - return 0, err - } - if blkNum == nil { - return 0, fmt.Errorf("GetActionDeadline failed, nil blkNum") - } - return blkNum.Uint64(), nil - } - return 0, errors.New("GetActionDeadline failed: invalid app channel type") -} - -func (c *AppClient) GetAppChannelSeqNum(cid string) (uint64, error) { - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return 0, fmt.Errorf("GetSeqNum error: app channel not found") - } - deployedAddr := appChannel.getDeployedAddr() - if deployedAddr == (ctype.ZeroAddr) { - return 0, fmt.Errorf("GetSeqNum error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err := NewISingleSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - seq, err := contract.GetSeqNum(&bind.CallOpts{}) - if err != nil { - return 0, err - } - if seq == nil { - return 0, fmt.Errorf("GetSeqNum failed, nil seq") - } - return seq.Uint64(), nil - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err := NewIMultiSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - seq, err := contract.GetSeqNum(&bind.CallOpts{}, appChannel.Session) - if err != nil { - return 0, err - } - if seq == nil { - return 0, fmt.Errorf("GetSeqNum failed, nil seq") - } - return seq.Uint64(), nil - } - return 0, errors.New("GetSeqNum failed: invalid app channel type") -} - -func (c *AppClient) GetAppChannelStatus(cid string) (uint8, error) { - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return 0, fmt.Errorf("GetStatus error: app channel not found") - } - deployedAddr := appChannel.getDeployedAddr() - if deployedAddr == (ctype.ZeroAddr) { - return 0, fmt.Errorf("GetStatus error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err := NewISingleSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - return contract.GetStatus(&bind.CallOpts{}) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err := NewIMultiSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return 0, err - } - return contract.GetStatus(&bind.CallOpts{}, appChannel.Session) - } - return 0, errors.New("GetStatus failed: invalid app channel type") -} - -func (c *AppClient) GetAppChannelState(cid string, key *big.Int) ([]byte, error) { - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return nil, fmt.Errorf("GetState error: app channel not found") - } - deployedAddr := appChannel.getDeployedAddr() - if deployedAddr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("GetState error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err := NewISingleSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return nil, err - } - return contract.GetState(&bind.CallOpts{}, key) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err := NewIMultiSessionCaller(deployedAddr, c.transactorPool.ContractCaller()) - if err != nil { - return nil, err - } - return contract.GetState(&bind.CallOpts{}, appChannel.Session, key) - } - return nil, errors.New("GetState failed: invalid app channel type") -} - -// SignAppState returns 1: proto serialized app state, 2: signature, 3: error -func (c *AppClient) SignAppState(cid string, seqNum uint64, state []byte) ([]byte, []byte, error) { - appChannel := c.GetAppChannel(cid) - if appChannel == nil { - return nil, nil, fmt.Errorf("SignAppState error: app channel not found") - } - appStateBytes, err := EncodeAppState(appChannel.Nonce, seqNum, state, appChannel.OnChainTimeout) - if err != nil { - return nil, appStateBytes, err - } - sig, err := c.signer.SignEthMessage(appStateBytes) - if err != nil { - return nil, appStateBytes, err - } - return appStateBytes, sig, nil -} - -func (c *AppClient) SettleBySigTimeout(gcid string, oracleProof []byte) error { - log.Infoln("Settle by signature timeout", gcid) - appChannel := c.GetAppChannel(gcid) - if appChannel == nil { - return fmt.Errorf("SettleBySigTimeout error: app channel not found") - } - - receipt, err := c.transactor.TransactWaitMined( - "SettleBySigTimeout", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - if addr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("FinalizeOnActionTimeout error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err2 := NewISingleSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleBySigTimeout(opts, oracleProof) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err2 := NewIMultiSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - - return contract.SettleBySigTimeout(opts, oracleProof) - } - return nil, errors.New("SettleBySigTimeout failed: invalid app channel type") - }, - config.QuickTransactOptions()...) - if err != nil { - log.Error(err) - return err - } - if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("SettleBySigTimeout transaction %x failed", receipt.TxHash) - } - return nil -} - -func (c *AppClient) SettleByMoveTimeout(gcid string, oracleProof []byte) error { - log.Infoln("Settle by movement timeout", gcid) - appChannel := c.GetAppChannel(gcid) - if appChannel == nil { - return fmt.Errorf("SettleByMoveTimeout error: app channel not found") - } - - receipt, err := c.transactor.TransactWaitMined( - "SettleByMoveTimeout", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - if addr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("FinalizeOnActionTimeout error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err2 := NewISingleSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleByMoveTimeout(opts, oracleProof) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err2 := NewIMultiSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleByMoveTimeout(opts, oracleProof) - } - return nil, errors.New("SettleByMoveTimeout failed: invalid app channel type") - }, - config.QuickTransactOptions()...) + finalized, err := contract.IsFinalized(&bind.CallOpts{}, query) if err != nil { - log.Error(err) - return err + return false, false, fmt.Errorf("contract IsFinalized error: %w", err) } - if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("SettleByMoveTimeout transaction %x failed", receipt.TxHash) - } - return nil -} - -func (c *AppClient) SettleByInvalidTurn(gcid string, oracleProof []byte, cosignedStateProof []byte) error { - log.Infoln("Settle by invalid turn", gcid) - appChannel := c.GetAppChannel(gcid) - if appChannel == nil { - return fmt.Errorf("SettleByInvalidTurn error: app channel not found") - } - - receipt, err := c.transactor.TransactWaitMined( - "SettleByInvalidTurn", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - if addr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("FinalizeOnActionTimeout error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err2 := NewISingleSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleByInvalidTurn(opts, oracleProof, cosignedStateProof) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err2 := NewIMultiSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleByInvalidTurn(opts, oracleProof, cosignedStateProof) - } - return nil, errors.New("SettleByInvalidTurn failed: invalid app channel type") - }, - config.QuickTransactOptions()...) + result, err := contract.GetOutcome(&bind.CallOpts{}, query) if err != nil { - log.Error(err) - return err - } - if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("SettleByInvalidTurn transaction %x failed", receipt.TxHash) + return false, false, fmt.Errorf("contract GetOutcome error: %w", err) } - return nil + return finalized, result, nil } -func (c *AppClient) SettleByInvalidState(gcid string, oracleProof []byte, cosignedStateProof []byte) error { - log.Infoln("Settle by invalid state", gcid) - appChannel := c.GetAppChannel(gcid) - if appChannel == nil { - return fmt.Errorf("SettleByInvalidState error: app channel not found") +// deployIfNeeded ensures the registered virtual condition contract is deployed +// on-chain and returns the deployed address. It serializes concurrent callers +// per `AppChannel` via `appChannel.mu` so two simultaneous deploy-on-query +// requests can't both submit a deploy transaction (which would either waste +// gas or revert with `VirtContractResolver`'s "Current real address is not 0" +// guard). +func (c *AppClient) deployIfNeeded(appChannel *AppChannel) (ctype.Addr, error) { + appChannel.mu.Lock() + defer appChannel.mu.Unlock() + if appChannel.deployedAddr != ctype.ZeroAddr { + return appChannel.deployedAddr, nil } - - receipt, err := c.transactor.TransactWaitMined( - "SettleByInvalidState", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - if addr == (ctype.ZeroAddr) { - return nil, fmt.Errorf("FinalizeOnActionTimeout error: app channel not deployed") - } - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT { - contract, err2 := NewISingleSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleByInvalidState(opts, oracleProof, cosignedStateProof) - } else if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - contract, err2 := NewIMultiSessionWithOracleTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.SettleByInvalidState(opts, oracleProof, cosignedStateProof) - } - return nil, errors.New("SettleByInvalidState failed: invalid app channel type") - }, - config.QuickTransactOptions()...) + addr, err := c.deployVirtualContract(appChannel.nonce, appChannel.byteCode, appChannel.constructor) if err != nil { - log.Error(err) - return err - } - if receipt.Status != types.ReceiptStatusSuccessful { - return fmt.Errorf("SettleByInvalidState transaction %x failed", receipt.TxHash) - } - return nil -} - -func (c *AppClient) deployIfNeeded(appChannel *AppChannel) error { - deployedAddr := appChannel.getDeployedAddr() - // Deploy virtual contract - if appChannel.Type == entity.ConditionType_VIRTUAL_CONTRACT && deployedAddr == (ctype.ZeroAddr) { - deployedAddr, err := - c.deployVirtualContract(appChannel.Nonce, appChannel.ByteCode, appChannel.Constructor) - if err != nil { - log.Error("virtual contract not deployed") - return err - } - appChannel.setDeployedAddr(deployedAddr) + log.Errorf("virtual contract not deployed: %s", err) + return ctype.ZeroAddr, err } - return nil + appChannel.deployedAddr = addr + return addr, nil } func (c *AppClient) deployVirtualContract( @@ -876,8 +226,8 @@ func (c *AppClient) deployVirtualContract( return ctype.ZeroAddr, fmt.Errorf("virtual contract not deployed") } -// isDeployed checks if the given virtual address has been deployed on-chain -// if yes, also returns the deployment address +// isDeployed checks if the given virtual address has been deployed on-chain; +// if yes, also returns the deployment address. func (c *AppClient) isDeployed(virtAddr []byte) (bool, ctype.Addr, error) { contract, err := virtresolver.NewVirtContractResolverCaller( c.nodeConfig.GetVirtResolverContract().GetAddr(), c.transactorPool.ContractCaller()) @@ -893,43 +243,10 @@ func (c *AppClient) isDeployed(virtAddr []byte) (bool, ctype.Addr, error) { return true, deployedAddr, nil } -func (c *AppClient) intendSettle(appChannel *AppChannel, stateproof []byte) error { - var err error - if appChannel.Type == entity.ConditionType_DEPLOYED_CONTRACT { - stateproof, err = SigSortedAppStateProof(stateproof) - if err != nil { - return err - } - } - _, err = c.transactorPool.SubmitWaitMined( - "intend settle app channel", - func(transactor bind.ContractTransactor, opts *bind.TransactOpts) (*types.Transaction, error) { - addr := appChannel.getDeployedAddr() - // intendSettle API for SingleSession and MultiSession contracts are same - contract, err2 := NewISingleSessionTransactor(addr, transactor) - if err2 != nil { - return nil, err2 - } - return contract.IntendSettle(opts, stateproof) - }, - config.QuickTransactOptions()...) - if err != nil { - log.Errorln("intend settle app channel tx error", err) - } - return err -} - -func (c *AppClient) getSessionID( - contractAddr ctype.Addr, nonce uint64, players []ctype.Addr) ([32]byte, error) { - contract, err := NewIMultiSessionCaller(contractAddr, c.transactorPool.ContractCaller()) - if err != nil { - var s [32]byte - return s, err - } - session, err := contract.GetSessionID(&bind.CallOpts{}, new(big.Int).SetUint64(nonce), players) - return session, err -} - +// GetVirtualAddress derives the deterministic virtual-contract address from +// `(bytecode, constructor, nonce)`. Used both at registration time (to compute +// the session id) and at deploy time (to look up the eventual on-chain address +// in the virt-resolver). func GetVirtualAddress(byteCode []byte, constructor []byte, nonce uint64) []byte { codeWithCons := append(byteCode, constructor...) return crypto.Keccak256(codeWithCons, utils.Pad(new(big.Int).SetUint64(nonce).Bytes(), 32)) diff --git a/app/appclient_virtresolver_watch_test.go b/app/appclient_virtresolver_watch_test.go deleted file mode 100644 index b0244c0..0000000 --- a/app/appclient_virtresolver_watch_test.go +++ /dev/null @@ -1,125 +0,0 @@ -package app - -import ( - "errors" - "math/big" - "sync" - "testing" - - "github.com/celer-network/agent-pay/chain" - "github.com/celer-network/agent-pay/common" - "github.com/celer-network/agent-pay/config" - "github.com/celer-network/agent-pay/ctype" - "github.com/celer-network/goutils/eth/monitor" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" -) - -type testStateCallback struct{} - -func (testStateCallback) OnDispute(int) {} - -type fakeMonitorService struct { - mu sync.Mutex - monitorHits int - removed []monitor.CallbackID -} - -func (m *fakeMonitorService) GetCurrentBlockNumber() *big.Int { return big.NewInt(1) } -func (m *fakeMonitorService) RegisterDeadline(monitor.Deadline) monitor.CallbackID { - return 0 -} -func (m *fakeMonitorService) Monitor(_ *monitor.Config, _ func(monitor.CallbackID, types.Log) bool) (monitor.CallbackID, error) { - m.mu.Lock() - defer m.mu.Unlock() - m.monitorHits++ - return monitor.CallbackID(123), nil -} -func (m *fakeMonitorService) RemoveDeadline(monitor.CallbackID) {} -func (m *fakeMonitorService) RemoveEvent(id monitor.CallbackID) { - m.mu.Lock() - defer m.mu.Unlock() - m.removed = append(m.removed, id) -} -func (m *fakeMonitorService) Close() {} - -type fakeContract struct{} - -func (fakeContract) GetAddr() ctype.Addr { return ctype.ZeroAddr } -func (fakeContract) GetABI() string { return "" } -func (fakeContract) GetETHClient() *ethclient.Client { return nil } -func (fakeContract) SendTransaction(*bind.TransactOpts, string, ...interface{}) (*types.Transaction, error) { - return nil, errors.New("not implemented") -} -func (fakeContract) CallFunc(interface{}, string, ...interface{}) error { - return errors.New("not implemented") -} -func (fakeContract) WatchEvent(string, *bind.WatchOpts, <-chan bool) (types.Log, error) { - return types.Log{}, errors.New("not implemented") -} -func (fakeContract) FilterEvent(string, *bind.FilterOpts, interface{}) (*chain.EventIterator, error) { - return nil, errors.New("not implemented") -} -func (fakeContract) ParseEvent(string, types.Log, interface{}) error { - return errors.New("not implemented") -} - -type fakeNodeConfig struct{ virt chain.Contract } - -func (f fakeNodeConfig) GetOnChainAddr() ctype.Addr { return ctype.ZeroAddr } -func (f fakeNodeConfig) GetEthPoolAddr() ctype.Addr { return ctype.ZeroAddr } -func (f fakeNodeConfig) GetEthConn() *ethclient.Client { return nil } -func (f fakeNodeConfig) GetRPCAddr() string { return "" } -func (f fakeNodeConfig) GetSvrName() string { return "" } -func (f fakeNodeConfig) GetWalletContract() chain.Contract { return nil } -func (f fakeNodeConfig) GetLedgerContract() chain.Contract { return nil } -func (f fakeNodeConfig) GetLedgerContractOn(ctype.Addr) chain.Contract { return nil } -func (f fakeNodeConfig) GetAllLedgerContracts() map[ctype.Addr]chain.Contract { return nil } -func (f fakeNodeConfig) GetLedgerContractOf(ctype.CidType) chain.Contract { return nil } -func (f fakeNodeConfig) GetVirtResolverContract() chain.Contract { return f.virt } -func (f fakeNodeConfig) GetPayResolverContract() chain.Contract { return nil } -func (f fakeNodeConfig) GetPayRegistryContract() chain.Contract { return nil } -func (f fakeNodeConfig) GetRouterRegistryContract() chain.Contract { return nil } -func (f fakeNodeConfig) GetCheckInterval(string) uint64 { return 0 } - -func TestNewAppChannelOnVirtualContract_SharedDeployWatch(t *testing.T) { - oldChainID := config.ChainId - config.ChainId = big.NewInt(1) - t.Cleanup(func() { config.ChainId = oldChainID }) - - ms := &fakeMonitorService{} - nc := fakeNodeConfig{virt: fakeContract{}} - - c := NewAppClient(nc, nil, nil, ms, nil, nil) - cb := common.StateCallback(testStateCallback{}) - - cid1, err := c.NewAppChannelOnVirtualContract([]byte{0x01}, []byte{0x02}, 1, 0, cb) - if err != nil { - t.Fatalf("first NewAppChannelOnVirtualContract failed: %v", err) - } - cid2, err := c.NewAppChannelOnVirtualContract([]byte{0x01}, []byte{0x02}, 2, 0, cb) - if err != nil { - t.Fatalf("second NewAppChannelOnVirtualContract failed: %v", err) - } - if cid1 == cid2 { - t.Fatalf("expected different cids, got both %s", cid1) - } - - ms.mu.Lock() - gotMonitorHits := ms.monitorHits - ms.mu.Unlock() - if gotMonitorHits != 1 { - t.Fatalf("expected 1 Monitor() call, got %d", gotMonitorHits) - } - - c.DeleteAppChannel(cid1) - c.DeleteAppChannel(cid2) - - ms.mu.Lock() - removed := append([]monitor.CallbackID(nil), ms.removed...) - ms.mu.Unlock() - if len(removed) != 1 { - t.Fatalf("expected shared watch removed once, got %d removals: %v", len(removed), removed) - } -} diff --git a/app/apputil.go b/app/apputil.go deleted file mode 100644 index 54041dd..0000000 --- a/app/apputil.go +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright 2018-2025 Celer Network - -package app - -import ( - "bytes" - "sort" - - "github.com/celer-network/agent-pay/ctype" - "github.com/celer-network/goutils/eth" - "github.com/celer-network/goutils/log" - "google.golang.org/protobuf/proto" -) - -func EncodeAppState(nonce uint64, seqNum uint64, state []byte, disputeTimeout uint64) ([]byte, error) { - appState := &AppState{ - Nonce: nonce, - SeqNum: seqNum, - State: state, - Timeout: disputeTimeout, - } - appStateBytes, err := proto.Marshal(appState) - if err != nil { - log.Error(err) - return nil, err - } - return appStateBytes, nil -} - -func DecodeAppState(appStateBytes []byte) (uint64, uint64, []byte, uint64, error) { - var appState AppState - err := proto.Unmarshal(appStateBytes, &appState) - if err != nil { - return 0, 0, nil, 0, err - } - return appState.Nonce, appState.SeqNum, appState.State, appState.Timeout, nil -} - -func EncodeAppStateProof(appStateBytes []byte, sigs [][]byte) ([]byte, error) { - stateProof := &StateProof{ - AppState: appStateBytes, - } - for _, sig := range sigs { - stateProof.Sigs = append(stateProof.Sigs, sig) - } - stateProofBytes, err := proto.Marshal(stateProof) - if err != nil { - log.Error(err) - return nil, err - } - return stateProofBytes, nil -} - -func DecodeAppStateProof(stateProofBytes []byte) ([]byte, [][]byte, error) { - var stateProof StateProof - err := proto.Unmarshal(stateProofBytes, &stateProof) - if err != nil { - return nil, nil, err - } - return stateProof.AppState, stateProof.Sigs, nil -} - -func SigSortedAppStateProof(proof []byte) ([]byte, error) { - var stateproof StateProof - err := proto.Unmarshal(proof, &stateproof) - if err != nil { - return nil, err - } - stateproof.Sigs = SortPlayerSigs(stateproof.AppState, stateproof.Sigs) - return proto.Marshal(&stateproof) -} - -type sortPlayerSigs struct { - players [][]byte - sigs [][]byte -} - -func (s sortPlayerSigs) Len() int { - return len(s.sigs) -} - -func (s sortPlayerSigs) Less(i, j int) bool { - switch bytes.Compare(s.players[i], s.players[j]) { - case -1: - return true - case 0, 1: - return false - default: - log.Error("not fail-able with `bytes.Comparable` bounded [-1, 1].") - return false - } -} - -func (s sortPlayerSigs) Swap(i, j int) { - s.players[j], s.players[i] = s.players[i], s.players[j] - s.sigs[j], s.sigs[i] = s.sigs[i], s.sigs[j] -} - -func SortPlayerSigs(state []byte, sigs [][]byte) [][]byte { - sorted := sortPlayerSigs{ - sigs: sigs, - } - for _, sig := range sigs { - signer, err := eth.RecoverSigner(state, sig) - if err != nil { - log.Error(err) - continue - } - sorted.players = append(sorted.players, signer.Bytes()) - } - sort.Sort(sorted) - return sorted.sigs -} - -type sortPlayers []ctype.Addr - -func (b sortPlayers) Len() int { - return len(b) -} - -func (b sortPlayers) Less(i, j int) bool { - // bytes package already implements Comparable for []byte. - switch bytes.Compare(b[i].Bytes(), b[j].Bytes()) { - case -1: - return true - case 0, 1: - return false - default: - log.Panic("not fail-able with `bytes.Comparable` bounded [-1, 1].") - return false - } -} - -func (b sortPlayers) Swap(i, j int) { - b[j], b[i] = b[i], b[j] -} - -func SortPlayers(src []ctype.Addr) []ctype.Addr { - sorted := sortPlayers(src) - sort.Sort(sorted) - return sorted -} diff --git a/app/booleancond.go b/app/booleancond.go new file mode 100644 index 0000000..131b236 --- /dev/null +++ b/app/booleancond.go @@ -0,0 +1,244 @@ +// Regenerated by tools/scripts/regenerate-go-bindings.sh — DO NOT EDIT. +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package app + +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" +) + +// 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 +) + +// IBooleanCondMetaData contains all meta data concerning the IBooleanCond contract. +var IBooleanCondMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"function\",\"name\":\"getOutcome\",\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isFinalized\",\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"}]", +} + +// IBooleanCondABI is the input ABI used to generate the binding from. +// Deprecated: Use IBooleanCondMetaData.ABI instead. +var IBooleanCondABI = IBooleanCondMetaData.ABI + +// IBooleanCond is an auto generated Go binding around an Ethereum contract. +type IBooleanCond struct { + IBooleanCondCaller // Read-only binding to the contract + IBooleanCondTransactor // Write-only binding to the contract + IBooleanCondFilterer // Log filterer for contract events +} + +// IBooleanCondCaller is an auto generated read-only Go binding around an Ethereum contract. +type IBooleanCondCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IBooleanCondTransactor is an auto generated write-only Go binding around an Ethereum contract. +type IBooleanCondTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IBooleanCondFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type IBooleanCondFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// IBooleanCondSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type IBooleanCondSession struct { + Contract *IBooleanCond // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IBooleanCondCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type IBooleanCondCallerSession struct { + Contract *IBooleanCondCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// IBooleanCondTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type IBooleanCondTransactorSession struct { + Contract *IBooleanCondTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// IBooleanCondRaw is an auto generated low-level Go binding around an Ethereum contract. +type IBooleanCondRaw struct { + Contract *IBooleanCond // Generic contract binding to access the raw methods on +} + +// IBooleanCondCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type IBooleanCondCallerRaw struct { + Contract *IBooleanCondCaller // Generic read-only contract binding to access the raw methods on +} + +// IBooleanCondTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type IBooleanCondTransactorRaw struct { + Contract *IBooleanCondTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewIBooleanCond creates a new instance of IBooleanCond, bound to a specific deployed contract. +func NewIBooleanCond(address common.Address, backend bind.ContractBackend) (*IBooleanCond, error) { + contract, err := bindIBooleanCond(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &IBooleanCond{IBooleanCondCaller: IBooleanCondCaller{contract: contract}, IBooleanCondTransactor: IBooleanCondTransactor{contract: contract}, IBooleanCondFilterer: IBooleanCondFilterer{contract: contract}}, nil +} + +// NewIBooleanCondCaller creates a new read-only instance of IBooleanCond, bound to a specific deployed contract. +func NewIBooleanCondCaller(address common.Address, caller bind.ContractCaller) (*IBooleanCondCaller, error) { + contract, err := bindIBooleanCond(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &IBooleanCondCaller{contract: contract}, nil +} + +// NewIBooleanCondTransactor creates a new write-only instance of IBooleanCond, bound to a specific deployed contract. +func NewIBooleanCondTransactor(address common.Address, transactor bind.ContractTransactor) (*IBooleanCondTransactor, error) { + contract, err := bindIBooleanCond(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &IBooleanCondTransactor{contract: contract}, nil +} + +// NewIBooleanCondFilterer creates a new log filterer instance of IBooleanCond, bound to a specific deployed contract. +func NewIBooleanCondFilterer(address common.Address, filterer bind.ContractFilterer) (*IBooleanCondFilterer, error) { + contract, err := bindIBooleanCond(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &IBooleanCondFilterer{contract: contract}, nil +} + +// bindIBooleanCond binds a generic wrapper to an already deployed contract. +func bindIBooleanCond(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := IBooleanCondMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IBooleanCond *IBooleanCondRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IBooleanCond.Contract.IBooleanCondCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IBooleanCond *IBooleanCondRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IBooleanCond.Contract.IBooleanCondTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IBooleanCond *IBooleanCondRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IBooleanCond.Contract.IBooleanCondTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_IBooleanCond *IBooleanCondCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _IBooleanCond.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_IBooleanCond *IBooleanCondTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _IBooleanCond.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_IBooleanCond *IBooleanCondTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _IBooleanCond.Contract.contract.Transact(opts, method, params...) +} + +// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. +// +// Solidity: function getOutcome(bytes _query) view returns(bool) +func (_IBooleanCond *IBooleanCondCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { + var out []interface{} + err := _IBooleanCond.contract.Call(opts, &out, "getOutcome", _query) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. +// +// Solidity: function getOutcome(bytes _query) view returns(bool) +func (_IBooleanCond *IBooleanCondSession) GetOutcome(_query []byte) (bool, error) { + return _IBooleanCond.Contract.GetOutcome(&_IBooleanCond.CallOpts, _query) +} + +// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. +// +// Solidity: function getOutcome(bytes _query) view returns(bool) +func (_IBooleanCond *IBooleanCondCallerSession) GetOutcome(_query []byte) (bool, error) { + return _IBooleanCond.Contract.GetOutcome(&_IBooleanCond.CallOpts, _query) +} + +// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. +// +// Solidity: function isFinalized(bytes _query) view returns(bool) +func (_IBooleanCond *IBooleanCondCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { + var out []interface{} + err := _IBooleanCond.contract.Call(opts, &out, "isFinalized", _query) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. +// +// Solidity: function isFinalized(bytes _query) view returns(bool) +func (_IBooleanCond *IBooleanCondSession) IsFinalized(_query []byte) (bool, error) { + return _IBooleanCond.Contract.IsFinalized(&_IBooleanCond.CallOpts, _query) +} + +// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. +// +// Solidity: function isFinalized(bytes _query) view returns(bool) +func (_IBooleanCond *IBooleanCondCallerSession) IsFinalized(_query []byte) (bool, error) { + return _IBooleanCond.Contract.IsFinalized(&_IBooleanCond.CallOpts, _query) +} diff --git a/app/booleanoutcome.go b/app/booleanoutcome.go deleted file mode 100644 index 111a0a0..0000000 --- a/app/booleanoutcome.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package app - -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" -) - -// 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 -) - -// IBooleanOutcomeMetaData contains all meta data concerning the IBooleanOutcome contract. -var IBooleanOutcomeMetaData = &bind.MetaData{ - ABI: "[{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// IBooleanOutcomeABI is the input ABI used to generate the binding from. -// Deprecated: Use IBooleanOutcomeMetaData.ABI instead. -var IBooleanOutcomeABI = IBooleanOutcomeMetaData.ABI - -// IBooleanOutcome is an auto generated Go binding around an Ethereum contract. -type IBooleanOutcome struct { - IBooleanOutcomeCaller // Read-only binding to the contract - IBooleanOutcomeTransactor // Write-only binding to the contract - IBooleanOutcomeFilterer // Log filterer for contract events -} - -// IBooleanOutcomeCaller is an auto generated read-only Go binding around an Ethereum contract. -type IBooleanOutcomeCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IBooleanOutcomeTransactor is an auto generated write-only Go binding around an Ethereum contract. -type IBooleanOutcomeTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IBooleanOutcomeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type IBooleanOutcomeFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IBooleanOutcomeSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type IBooleanOutcomeSession struct { - Contract *IBooleanOutcome // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IBooleanOutcomeCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type IBooleanOutcomeCallerSession struct { - Contract *IBooleanOutcomeCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// IBooleanOutcomeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type IBooleanOutcomeTransactorSession struct { - Contract *IBooleanOutcomeTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IBooleanOutcomeRaw is an auto generated low-level Go binding around an Ethereum contract. -type IBooleanOutcomeRaw struct { - Contract *IBooleanOutcome // Generic contract binding to access the raw methods on -} - -// IBooleanOutcomeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type IBooleanOutcomeCallerRaw struct { - Contract *IBooleanOutcomeCaller // Generic read-only contract binding to access the raw methods on -} - -// IBooleanOutcomeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type IBooleanOutcomeTransactorRaw struct { - Contract *IBooleanOutcomeTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewIBooleanOutcome creates a new instance of IBooleanOutcome, bound to a specific deployed contract. -func NewIBooleanOutcome(address common.Address, backend bind.ContractBackend) (*IBooleanOutcome, error) { - contract, err := bindIBooleanOutcome(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &IBooleanOutcome{IBooleanOutcomeCaller: IBooleanOutcomeCaller{contract: contract}, IBooleanOutcomeTransactor: IBooleanOutcomeTransactor{contract: contract}, IBooleanOutcomeFilterer: IBooleanOutcomeFilterer{contract: contract}}, nil -} - -// NewIBooleanOutcomeCaller creates a new read-only instance of IBooleanOutcome, bound to a specific deployed contract. -func NewIBooleanOutcomeCaller(address common.Address, caller bind.ContractCaller) (*IBooleanOutcomeCaller, error) { - contract, err := bindIBooleanOutcome(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &IBooleanOutcomeCaller{contract: contract}, nil -} - -// NewIBooleanOutcomeTransactor creates a new write-only instance of IBooleanOutcome, bound to a specific deployed contract. -func NewIBooleanOutcomeTransactor(address common.Address, transactor bind.ContractTransactor) (*IBooleanOutcomeTransactor, error) { - contract, err := bindIBooleanOutcome(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &IBooleanOutcomeTransactor{contract: contract}, nil -} - -// NewIBooleanOutcomeFilterer creates a new log filterer instance of IBooleanOutcome, bound to a specific deployed contract. -func NewIBooleanOutcomeFilterer(address common.Address, filterer bind.ContractFilterer) (*IBooleanOutcomeFilterer, error) { - contract, err := bindIBooleanOutcome(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &IBooleanOutcomeFilterer{contract: contract}, nil -} - -// bindIBooleanOutcome binds a generic wrapper to an already deployed contract. -func bindIBooleanOutcome(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := IBooleanOutcomeMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_IBooleanOutcome *IBooleanOutcomeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _IBooleanOutcome.Contract.IBooleanOutcomeCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_IBooleanOutcome *IBooleanOutcomeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _IBooleanOutcome.Contract.IBooleanOutcomeTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_IBooleanOutcome *IBooleanOutcomeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _IBooleanOutcome.Contract.IBooleanOutcomeTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_IBooleanOutcome *IBooleanOutcomeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _IBooleanOutcome.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_IBooleanOutcome *IBooleanOutcomeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _IBooleanOutcome.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_IBooleanOutcome *IBooleanOutcomeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _IBooleanOutcome.Contract.contract.Transact(opts, method, params...) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_IBooleanOutcome *IBooleanOutcomeCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _IBooleanOutcome.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_IBooleanOutcome *IBooleanOutcomeSession) GetOutcome(_query []byte) (bool, error) { - return _IBooleanOutcome.Contract.GetOutcome(&_IBooleanOutcome.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_IBooleanOutcome *IBooleanOutcomeCallerSession) GetOutcome(_query []byte) (bool, error) { - return _IBooleanOutcome.Contract.GetOutcome(&_IBooleanOutcome.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_IBooleanOutcome *IBooleanOutcomeCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _IBooleanOutcome.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_IBooleanOutcome *IBooleanOutcomeSession) IsFinalized(_query []byte) (bool, error) { - return _IBooleanOutcome.Contract.IsFinalized(&_IBooleanOutcome.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_IBooleanOutcome *IBooleanOutcomeCallerSession) IsFinalized(_query []byte) (bool, error) { - return _IBooleanOutcome.Contract.IsFinalized(&_IBooleanOutcome.CallOpts, _query) -} diff --git a/app/multisession.go b/app/multisession.go deleted file mode 100644 index db5574c..0000000 --- a/app/multisession.go +++ /dev/null @@ -1,575 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package app - -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" -) - -// 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 -) - -// IMultiSessionMetaData contains all meta data concerning the IMultiSession contract. -var IMultiSessionMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"session\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"seq\",\"type\":\"uint256\"}],\"name\":\"IntendSettle\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"name\":\"_stateProof\",\"type\":\"bytes\"}],\"name\":\"intendSettle\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getSettleFinalizedTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_action\",\"type\":\"bytes\"}],\"name\":\"applyAction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"finalizeOnActionTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getActionDeadline\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getSeqNum\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_signers\",\"type\":\"address[]\"}],\"name\":\"getSessionID\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]", -} - -// IMultiSessionABI is the input ABI used to generate the binding from. -// Deprecated: Use IMultiSessionMetaData.ABI instead. -var IMultiSessionABI = IMultiSessionMetaData.ABI - -// IMultiSession is an auto generated Go binding around an Ethereum contract. -type IMultiSession struct { - IMultiSessionCaller // Read-only binding to the contract - IMultiSessionTransactor // Write-only binding to the contract - IMultiSessionFilterer // Log filterer for contract events -} - -// IMultiSessionCaller is an auto generated read-only Go binding around an Ethereum contract. -type IMultiSessionCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IMultiSessionTransactor is an auto generated write-only Go binding around an Ethereum contract. -type IMultiSessionTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IMultiSessionFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type IMultiSessionFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IMultiSessionSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type IMultiSessionSession struct { - Contract *IMultiSession // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IMultiSessionCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type IMultiSessionCallerSession struct { - Contract *IMultiSessionCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// IMultiSessionTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type IMultiSessionTransactorSession struct { - Contract *IMultiSessionTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IMultiSessionRaw is an auto generated low-level Go binding around an Ethereum contract. -type IMultiSessionRaw struct { - Contract *IMultiSession // Generic contract binding to access the raw methods on -} - -// IMultiSessionCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type IMultiSessionCallerRaw struct { - Contract *IMultiSessionCaller // Generic read-only contract binding to access the raw methods on -} - -// IMultiSessionTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type IMultiSessionTransactorRaw struct { - Contract *IMultiSessionTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewIMultiSession creates a new instance of IMultiSession, bound to a specific deployed contract. -func NewIMultiSession(address common.Address, backend bind.ContractBackend) (*IMultiSession, error) { - contract, err := bindIMultiSession(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &IMultiSession{IMultiSessionCaller: IMultiSessionCaller{contract: contract}, IMultiSessionTransactor: IMultiSessionTransactor{contract: contract}, IMultiSessionFilterer: IMultiSessionFilterer{contract: contract}}, nil -} - -// NewIMultiSessionCaller creates a new read-only instance of IMultiSession, bound to a specific deployed contract. -func NewIMultiSessionCaller(address common.Address, caller bind.ContractCaller) (*IMultiSessionCaller, error) { - contract, err := bindIMultiSession(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &IMultiSessionCaller{contract: contract}, nil -} - -// NewIMultiSessionTransactor creates a new write-only instance of IMultiSession, bound to a specific deployed contract. -func NewIMultiSessionTransactor(address common.Address, transactor bind.ContractTransactor) (*IMultiSessionTransactor, error) { - contract, err := bindIMultiSession(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &IMultiSessionTransactor{contract: contract}, nil -} - -// NewIMultiSessionFilterer creates a new log filterer instance of IMultiSession, bound to a specific deployed contract. -func NewIMultiSessionFilterer(address common.Address, filterer bind.ContractFilterer) (*IMultiSessionFilterer, error) { - contract, err := bindIMultiSession(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &IMultiSessionFilterer{contract: contract}, nil -} - -// bindIMultiSession binds a generic wrapper to an already deployed contract. -func bindIMultiSession(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := IMultiSessionMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_IMultiSession *IMultiSessionRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _IMultiSession.Contract.IMultiSessionCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_IMultiSession *IMultiSessionRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _IMultiSession.Contract.IMultiSessionTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_IMultiSession *IMultiSessionRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _IMultiSession.Contract.IMultiSessionTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_IMultiSession *IMultiSessionCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _IMultiSession.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_IMultiSession *IMultiSessionTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _IMultiSession.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_IMultiSession *IMultiSessionTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _IMultiSession.Contract.contract.Transact(opts, method, params...) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionCaller) GetActionDeadline(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _IMultiSession.contract.Call(opts, &out, "getActionDeadline", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionSession) GetActionDeadline(_session [32]byte) (*big.Int, error) { - return _IMultiSession.Contract.GetActionDeadline(&_IMultiSession.CallOpts, _session) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionCallerSession) GetActionDeadline(_session [32]byte) (*big.Int, error) { - return _IMultiSession.Contract.GetActionDeadline(&_IMultiSession.CallOpts, _session) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionCaller) GetSeqNum(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _IMultiSession.contract.Call(opts, &out, "getSeqNum", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionSession) GetSeqNum(_session [32]byte) (*big.Int, error) { - return _IMultiSession.Contract.GetSeqNum(&_IMultiSession.CallOpts, _session) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionCallerSession) GetSeqNum(_session [32]byte) (*big.Int, error) { - return _IMultiSession.Contract.GetSeqNum(&_IMultiSession.CallOpts, _session) -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_IMultiSession *IMultiSessionCaller) GetSessionID(opts *bind.CallOpts, _nonce *big.Int, _signers []common.Address) ([32]byte, error) { - var out []interface{} - err := _IMultiSession.contract.Call(opts, &out, "getSessionID", _nonce, _signers) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_IMultiSession *IMultiSessionSession) GetSessionID(_nonce *big.Int, _signers []common.Address) ([32]byte, error) { - return _IMultiSession.Contract.GetSessionID(&_IMultiSession.CallOpts, _nonce, _signers) -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_IMultiSession *IMultiSessionCallerSession) GetSessionID(_nonce *big.Int, _signers []common.Address) ([32]byte, error) { - return _IMultiSession.Contract.GetSessionID(&_IMultiSession.CallOpts, _nonce, _signers) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionCaller) GetSettleFinalizedTime(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _IMultiSession.contract.Call(opts, &out, "getSettleFinalizedTime", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionSession) GetSettleFinalizedTime(_session [32]byte) (*big.Int, error) { - return _IMultiSession.Contract.GetSettleFinalizedTime(&_IMultiSession.CallOpts, _session) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_IMultiSession *IMultiSessionCallerSession) GetSettleFinalizedTime(_session [32]byte) (*big.Int, error) { - return _IMultiSession.Contract.GetSettleFinalizedTime(&_IMultiSession.CallOpts, _session) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_IMultiSession *IMultiSessionCaller) GetState(opts *bind.CallOpts, _session [32]byte, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _IMultiSession.contract.Call(opts, &out, "getState", _session, _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_IMultiSession *IMultiSessionSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _IMultiSession.Contract.GetState(&_IMultiSession.CallOpts, _session, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_IMultiSession *IMultiSessionCallerSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _IMultiSession.Contract.GetState(&_IMultiSession.CallOpts, _session, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_IMultiSession *IMultiSessionCaller) GetStatus(opts *bind.CallOpts, _session [32]byte) (uint8, error) { - var out []interface{} - err := _IMultiSession.contract.Call(opts, &out, "getStatus", _session) - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_IMultiSession *IMultiSessionSession) GetStatus(_session [32]byte) (uint8, error) { - return _IMultiSession.Contract.GetStatus(&_IMultiSession.CallOpts, _session) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_IMultiSession *IMultiSessionCallerSession) GetStatus(_session [32]byte) (uint8, error) { - return _IMultiSession.Contract.GetStatus(&_IMultiSession.CallOpts, _session) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_IMultiSession *IMultiSessionTransactor) ApplyAction(opts *bind.TransactOpts, _session [32]byte, _action []byte) (*types.Transaction, error) { - return _IMultiSession.contract.Transact(opts, "applyAction", _session, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_IMultiSession *IMultiSessionSession) ApplyAction(_session [32]byte, _action []byte) (*types.Transaction, error) { - return _IMultiSession.Contract.ApplyAction(&_IMultiSession.TransactOpts, _session, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_IMultiSession *IMultiSessionTransactorSession) ApplyAction(_session [32]byte, _action []byte) (*types.Transaction, error) { - return _IMultiSession.Contract.ApplyAction(&_IMultiSession.TransactOpts, _session, _action) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_IMultiSession *IMultiSessionTransactor) FinalizeOnActionTimeout(opts *bind.TransactOpts, _session [32]byte) (*types.Transaction, error) { - return _IMultiSession.contract.Transact(opts, "finalizeOnActionTimeout", _session) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_IMultiSession *IMultiSessionSession) FinalizeOnActionTimeout(_session [32]byte) (*types.Transaction, error) { - return _IMultiSession.Contract.FinalizeOnActionTimeout(&_IMultiSession.TransactOpts, _session) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_IMultiSession *IMultiSessionTransactorSession) FinalizeOnActionTimeout(_session [32]byte) (*types.Transaction, error) { - return _IMultiSession.Contract.FinalizeOnActionTimeout(&_IMultiSession.TransactOpts, _session) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_IMultiSession *IMultiSessionTransactor) IntendSettle(opts *bind.TransactOpts, _stateProof []byte) (*types.Transaction, error) { - return _IMultiSession.contract.Transact(opts, "intendSettle", _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_IMultiSession *IMultiSessionSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _IMultiSession.Contract.IntendSettle(&_IMultiSession.TransactOpts, _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_IMultiSession *IMultiSessionTransactorSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _IMultiSession.Contract.IntendSettle(&_IMultiSession.TransactOpts, _stateProof) -} - -// IMultiSessionIntendSettleIterator is returned from FilterIntendSettle and is used to iterate over the raw logs and unpacked data for IntendSettle events raised by the IMultiSession contract. -type IMultiSessionIntendSettleIterator struct { - Event *IMultiSessionIntendSettle // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *IMultiSessionIntendSettleIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(IMultiSessionIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(IMultiSessionIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *IMultiSessionIntendSettleIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *IMultiSessionIntendSettleIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// IMultiSessionIntendSettle represents a IntendSettle event raised by the IMultiSession contract. -type IMultiSessionIntendSettle struct { - Session [32]byte - Seq *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIntendSettle is a free log retrieval operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_IMultiSession *IMultiSessionFilterer) FilterIntendSettle(opts *bind.FilterOpts, session [][32]byte) (*IMultiSessionIntendSettleIterator, error) { - - var sessionRule []interface{} - for _, sessionItem := range session { - sessionRule = append(sessionRule, sessionItem) - } - - logs, sub, err := _IMultiSession.contract.FilterLogs(opts, "IntendSettle", sessionRule) - if err != nil { - return nil, err - } - return &IMultiSessionIntendSettleIterator{contract: _IMultiSession.contract, event: "IntendSettle", logs: logs, sub: sub}, nil -} - -// WatchIntendSettle is a free log subscription operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_IMultiSession *IMultiSessionFilterer) WatchIntendSettle(opts *bind.WatchOpts, sink chan<- *IMultiSessionIntendSettle, session [][32]byte) (event.Subscription, error) { - - var sessionRule []interface{} - for _, sessionItem := range session { - sessionRule = append(sessionRule, sessionItem) - } - - logs, sub, err := _IMultiSession.contract.WatchLogs(opts, "IntendSettle", sessionRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(IMultiSessionIntendSettle) - if err := _IMultiSession.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIntendSettle is a log parse operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_IMultiSession *IMultiSessionFilterer) ParseIntendSettle(log types.Log) (*IMultiSessionIntendSettle, error) { - event := new(IMultiSessionIntendSettle) - if err := _IMultiSession.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/app/multisessionwithoracle.go b/app/multisessionwithoracle.go deleted file mode 100644 index 073b3e7..0000000 --- a/app/multisessionwithoracle.go +++ /dev/null @@ -1,348 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package app - -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" -) - -// 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 -) - -// IMultiSessionWithOracleMetaData contains all meta data concerning the IMultiSessionWithOracle contract. -var IMultiSessionWithOracleMetaData = &bind.MetaData{ - ABI: "[{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleBySigTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleByMoveTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidTurn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_signers\",\"type\":\"address[]\"}],\"name\":\"getSessionID\",\"outputs\":[{\"name\":\"session\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// IMultiSessionWithOracleABI is the input ABI used to generate the binding from. -// Deprecated: Use IMultiSessionWithOracleMetaData.ABI instead. -var IMultiSessionWithOracleABI = IMultiSessionWithOracleMetaData.ABI - -// IMultiSessionWithOracle is an auto generated Go binding around an Ethereum contract. -type IMultiSessionWithOracle struct { - IMultiSessionWithOracleCaller // Read-only binding to the contract - IMultiSessionWithOracleTransactor // Write-only binding to the contract - IMultiSessionWithOracleFilterer // Log filterer for contract events -} - -// IMultiSessionWithOracleCaller is an auto generated read-only Go binding around an Ethereum contract. -type IMultiSessionWithOracleCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IMultiSessionWithOracleTransactor is an auto generated write-only Go binding around an Ethereum contract. -type IMultiSessionWithOracleTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IMultiSessionWithOracleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type IMultiSessionWithOracleFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// IMultiSessionWithOracleSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type IMultiSessionWithOracleSession struct { - Contract *IMultiSessionWithOracle // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IMultiSessionWithOracleCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type IMultiSessionWithOracleCallerSession struct { - Contract *IMultiSessionWithOracleCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// IMultiSessionWithOracleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type IMultiSessionWithOracleTransactorSession struct { - Contract *IMultiSessionWithOracleTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// IMultiSessionWithOracleRaw is an auto generated low-level Go binding around an Ethereum contract. -type IMultiSessionWithOracleRaw struct { - Contract *IMultiSessionWithOracle // Generic contract binding to access the raw methods on -} - -// IMultiSessionWithOracleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type IMultiSessionWithOracleCallerRaw struct { - Contract *IMultiSessionWithOracleCaller // Generic read-only contract binding to access the raw methods on -} - -// IMultiSessionWithOracleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type IMultiSessionWithOracleTransactorRaw struct { - Contract *IMultiSessionWithOracleTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewIMultiSessionWithOracle creates a new instance of IMultiSessionWithOracle, bound to a specific deployed contract. -func NewIMultiSessionWithOracle(address common.Address, backend bind.ContractBackend) (*IMultiSessionWithOracle, error) { - contract, err := bindIMultiSessionWithOracle(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &IMultiSessionWithOracle{IMultiSessionWithOracleCaller: IMultiSessionWithOracleCaller{contract: contract}, IMultiSessionWithOracleTransactor: IMultiSessionWithOracleTransactor{contract: contract}, IMultiSessionWithOracleFilterer: IMultiSessionWithOracleFilterer{contract: contract}}, nil -} - -// NewIMultiSessionWithOracleCaller creates a new read-only instance of IMultiSessionWithOracle, bound to a specific deployed contract. -func NewIMultiSessionWithOracleCaller(address common.Address, caller bind.ContractCaller) (*IMultiSessionWithOracleCaller, error) { - contract, err := bindIMultiSessionWithOracle(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &IMultiSessionWithOracleCaller{contract: contract}, nil -} - -// NewIMultiSessionWithOracleTransactor creates a new write-only instance of IMultiSessionWithOracle, bound to a specific deployed contract. -func NewIMultiSessionWithOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*IMultiSessionWithOracleTransactor, error) { - contract, err := bindIMultiSessionWithOracle(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &IMultiSessionWithOracleTransactor{contract: contract}, nil -} - -// NewIMultiSessionWithOracleFilterer creates a new log filterer instance of IMultiSessionWithOracle, bound to a specific deployed contract. -func NewIMultiSessionWithOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*IMultiSessionWithOracleFilterer, error) { - contract, err := bindIMultiSessionWithOracle(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &IMultiSessionWithOracleFilterer{contract: contract}, nil -} - -// bindIMultiSessionWithOracle binds a generic wrapper to an already deployed contract. -func bindIMultiSessionWithOracle(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := IMultiSessionWithOracleMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_IMultiSessionWithOracle *IMultiSessionWithOracleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _IMultiSessionWithOracle.Contract.IMultiSessionWithOracleCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_IMultiSessionWithOracle *IMultiSessionWithOracleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.IMultiSessionWithOracleTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_IMultiSessionWithOracle *IMultiSessionWithOracleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.IMultiSessionWithOracleTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_IMultiSessionWithOracle *IMultiSessionWithOracleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _IMultiSessionWithOracle.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.contract.Transact(opts, method, params...) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleCaller) GetState(opts *bind.CallOpts, _session [32]byte, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _IMultiSessionWithOracle.contract.Call(opts, &out, "getState", _session, _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _IMultiSessionWithOracle.Contract.GetState(&_IMultiSessionWithOracle.CallOpts, _session, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleCallerSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _IMultiSessionWithOracle.Contract.GetState(&_IMultiSessionWithOracle.CallOpts, _session, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleCaller) GetStatus(opts *bind.CallOpts, _session [32]byte) (uint8, error) { - var out []interface{} - err := _IMultiSessionWithOracle.contract.Call(opts, &out, "getStatus", _session) - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) GetStatus(_session [32]byte) (uint8, error) { - return _IMultiSessionWithOracle.Contract.GetStatus(&_IMultiSessionWithOracle.CallOpts, _session) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleCallerSession) GetStatus(_session [32]byte) (uint8, error) { - return _IMultiSessionWithOracle.Contract.GetStatus(&_IMultiSessionWithOracle.CallOpts, _session) -} - -// GetSessionID is a paid mutator transaction binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) returns(bytes32 session) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactor) GetSessionID(opts *bind.TransactOpts, _nonce *big.Int, _signers []common.Address) (*types.Transaction, error) { - return _IMultiSessionWithOracle.contract.Transact(opts, "getSessionID", _nonce, _signers) -} - -// GetSessionID is a paid mutator transaction binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) returns(bytes32 session) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) GetSessionID(_nonce *big.Int, _signers []common.Address) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.GetSessionID(&_IMultiSessionWithOracle.TransactOpts, _nonce, _signers) -} - -// GetSessionID is a paid mutator transaction binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) returns(bytes32 session) -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorSession) GetSessionID(_nonce *big.Int, _signers []common.Address) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.GetSessionID(&_IMultiSessionWithOracle.TransactOpts, _nonce, _signers) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactor) SettleByInvalidState(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.contract.Transact(opts, "settleByInvalidState", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleByInvalidState(&_IMultiSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleByInvalidState(&_IMultiSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactor) SettleByInvalidTurn(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.contract.Transact(opts, "settleByInvalidTurn", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleByInvalidTurn(&_IMultiSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleByInvalidTurn(&_IMultiSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactor) SettleByMoveTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.contract.Transact(opts, "settleByMoveTimeout", _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleByMoveTimeout(&_IMultiSessionWithOracle.TransactOpts, _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleByMoveTimeout(&_IMultiSessionWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactor) SettleBySigTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.contract.Transact(opts, "settleBySigTimeout", _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleBySigTimeout(&_IMultiSessionWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_IMultiSessionWithOracle *IMultiSessionWithOracleTransactorSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _IMultiSessionWithOracle.Contract.SettleBySigTimeout(&_IMultiSessionWithOracle.TransactOpts, _oracleProof) -} diff --git a/app/numericoutcome.go b/app/numericoutcome.go deleted file mode 100644 index 31322af..0000000 --- a/app/numericoutcome.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package app - -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" -) - -// 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 -) - -// INumericOutcomeMetaData contains all meta data concerning the INumericOutcome contract. -var INumericOutcomeMetaData = &bind.MetaData{ - ABI: "[{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// INumericOutcomeABI is the input ABI used to generate the binding from. -// Deprecated: Use INumericOutcomeMetaData.ABI instead. -var INumericOutcomeABI = INumericOutcomeMetaData.ABI - -// INumericOutcome is an auto generated Go binding around an Ethereum contract. -type INumericOutcome struct { - INumericOutcomeCaller // Read-only binding to the contract - INumericOutcomeTransactor // Write-only binding to the contract - INumericOutcomeFilterer // Log filterer for contract events -} - -// INumericOutcomeCaller is an auto generated read-only Go binding around an Ethereum contract. -type INumericOutcomeCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// INumericOutcomeTransactor is an auto generated write-only Go binding around an Ethereum contract. -type INumericOutcomeTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// INumericOutcomeFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type INumericOutcomeFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// INumericOutcomeSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type INumericOutcomeSession struct { - Contract *INumericOutcome // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// INumericOutcomeCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type INumericOutcomeCallerSession struct { - Contract *INumericOutcomeCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// INumericOutcomeTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type INumericOutcomeTransactorSession struct { - Contract *INumericOutcomeTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// INumericOutcomeRaw is an auto generated low-level Go binding around an Ethereum contract. -type INumericOutcomeRaw struct { - Contract *INumericOutcome // Generic contract binding to access the raw methods on -} - -// INumericOutcomeCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type INumericOutcomeCallerRaw struct { - Contract *INumericOutcomeCaller // Generic read-only contract binding to access the raw methods on -} - -// INumericOutcomeTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type INumericOutcomeTransactorRaw struct { - Contract *INumericOutcomeTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewINumericOutcome creates a new instance of INumericOutcome, bound to a specific deployed contract. -func NewINumericOutcome(address common.Address, backend bind.ContractBackend) (*INumericOutcome, error) { - contract, err := bindINumericOutcome(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &INumericOutcome{INumericOutcomeCaller: INumericOutcomeCaller{contract: contract}, INumericOutcomeTransactor: INumericOutcomeTransactor{contract: contract}, INumericOutcomeFilterer: INumericOutcomeFilterer{contract: contract}}, nil -} - -// NewINumericOutcomeCaller creates a new read-only instance of INumericOutcome, bound to a specific deployed contract. -func NewINumericOutcomeCaller(address common.Address, caller bind.ContractCaller) (*INumericOutcomeCaller, error) { - contract, err := bindINumericOutcome(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &INumericOutcomeCaller{contract: contract}, nil -} - -// NewINumericOutcomeTransactor creates a new write-only instance of INumericOutcome, bound to a specific deployed contract. -func NewINumericOutcomeTransactor(address common.Address, transactor bind.ContractTransactor) (*INumericOutcomeTransactor, error) { - contract, err := bindINumericOutcome(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &INumericOutcomeTransactor{contract: contract}, nil -} - -// NewINumericOutcomeFilterer creates a new log filterer instance of INumericOutcome, bound to a specific deployed contract. -func NewINumericOutcomeFilterer(address common.Address, filterer bind.ContractFilterer) (*INumericOutcomeFilterer, error) { - contract, err := bindINumericOutcome(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &INumericOutcomeFilterer{contract: contract}, nil -} - -// bindINumericOutcome binds a generic wrapper to an already deployed contract. -func bindINumericOutcome(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := INumericOutcomeMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_INumericOutcome *INumericOutcomeRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _INumericOutcome.Contract.INumericOutcomeCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_INumericOutcome *INumericOutcomeRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _INumericOutcome.Contract.INumericOutcomeTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_INumericOutcome *INumericOutcomeRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _INumericOutcome.Contract.INumericOutcomeTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_INumericOutcome *INumericOutcomeCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _INumericOutcome.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_INumericOutcome *INumericOutcomeTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _INumericOutcome.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_INumericOutcome *INumericOutcomeTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _INumericOutcome.Contract.contract.Transact(opts, method, params...) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(uint256) -func (_INumericOutcome *INumericOutcomeCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (*big.Int, error) { - var out []interface{} - err := _INumericOutcome.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(uint256) -func (_INumericOutcome *INumericOutcomeSession) GetOutcome(_query []byte) (*big.Int, error) { - return _INumericOutcome.Contract.GetOutcome(&_INumericOutcome.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(uint256) -func (_INumericOutcome *INumericOutcomeCallerSession) GetOutcome(_query []byte) (*big.Int, error) { - return _INumericOutcome.Contract.GetOutcome(&_INumericOutcome.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_INumericOutcome *INumericOutcomeCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _INumericOutcome.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_INumericOutcome *INumericOutcomeSession) IsFinalized(_query []byte) (bool, error) { - return _INumericOutcome.Contract.IsFinalized(&_INumericOutcome.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_INumericOutcome *INumericOutcomeCallerSession) IsFinalized(_query []byte) (bool, error) { - return _INumericOutcome.Contract.IsFinalized(&_INumericOutcome.CallOpts, _query) -} diff --git a/app/oracle.go b/app/oracle.go deleted file mode 100644 index 5161862..0000000 --- a/app/oracle.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: contracts/lib/proto/oracle.proto - -package app - -import ( - fmt "fmt" - math "math" - - proto "github.com/golang/protobuf/proto" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type OracleState struct { - // serialized stateProof - StateProof []byte `protobuf:"bytes,1,opt,name=state_proof,json=stateProof,proto3" json:"state_proof,omitempty"` - // the address of user who updated the stateproof - Updater []byte `protobuf:"bytes,2,opt,name=updater,proto3" json:"updater,omitempty"` - // block number when state proof updated - UpdateTime uint64 `protobuf:"varint,3,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` - // block number when oracle proof requested - CurrentTime uint64 `protobuf:"varint,4,opt,name=current_time,json=currentTime,proto3" json:"current_time,omitempty"` - // player addresses - Players [][]byte `protobuf:"bytes,5,rep,name=players,proto3" json:"players,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OracleState) Reset() { *m = OracleState{} } -func (m *OracleState) String() string { return proto.CompactTextString(m) } -func (*OracleState) ProtoMessage() {} -func (*OracleState) Descriptor() ([]byte, []int) { - return fileDescriptor_efa7501b25fb2e42, []int{0} -} - -func (m *OracleState) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OracleState.Unmarshal(m, b) -} -func (m *OracleState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OracleState.Marshal(b, m, deterministic) -} -func (m *OracleState) XXX_Merge(src proto.Message) { - xxx_messageInfo_OracleState.Merge(m, src) -} -func (m *OracleState) XXX_Size() int { - return xxx_messageInfo_OracleState.Size(m) -} -func (m *OracleState) XXX_DiscardUnknown() { - xxx_messageInfo_OracleState.DiscardUnknown(m) -} - -var xxx_messageInfo_OracleState proto.InternalMessageInfo - -func (m *OracleState) GetStateProof() []byte { - if m != nil { - return m.StateProof - } - return nil -} - -func (m *OracleState) GetUpdater() []byte { - if m != nil { - return m.Updater - } - return nil -} - -func (m *OracleState) GetUpdateTime() uint64 { - if m != nil { - return m.UpdateTime - } - return 0 -} - -func (m *OracleState) GetCurrentTime() uint64 { - if m != nil { - return m.CurrentTime - } - return 0 -} - -func (m *OracleState) GetPlayers() [][]byte { - if m != nil { - return m.Players - } - return nil -} - -type OracleProof struct { - OracleState []byte `protobuf:"bytes,1,opt,name=oracle_state,json=oracleState,proto3" json:"oracle_state,omitempty"` - Sig []byte `protobuf:"bytes,2,opt,name=sig,proto3" json:"sig,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OracleProof) Reset() { *m = OracleProof{} } -func (m *OracleProof) String() string { return proto.CompactTextString(m) } -func (*OracleProof) ProtoMessage() {} -func (*OracleProof) Descriptor() ([]byte, []int) { - return fileDescriptor_efa7501b25fb2e42, []int{1} -} - -func (m *OracleProof) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OracleProof.Unmarshal(m, b) -} -func (m *OracleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OracleProof.Marshal(b, m, deterministic) -} -func (m *OracleProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_OracleProof.Merge(m, src) -} -func (m *OracleProof) XXX_Size() int { - return xxx_messageInfo_OracleProof.Size(m) -} -func (m *OracleProof) XXX_DiscardUnknown() { - xxx_messageInfo_OracleProof.DiscardUnknown(m) -} - -var xxx_messageInfo_OracleProof proto.InternalMessageInfo - -func (m *OracleProof) GetOracleState() []byte { - if m != nil { - return m.OracleState - } - return nil -} - -func (m *OracleProof) GetSig() []byte { - if m != nil { - return m.Sig - } - return nil -} - -func init() { - proto.RegisterType((*OracleState)(nil), "oracle.OracleState") - proto.RegisterType((*OracleProof)(nil), "oracle.OracleProof") -} - -func init() { proto.RegisterFile("contracts/lib/proto/oracle.proto", fileDescriptor_efa7501b25fb2e42) } - -var fileDescriptor_efa7501b25fb2e42 = []byte{ - // 287 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xb1, 0x6a, 0xc3, 0x30, - 0x10, 0x86, 0x71, 0x93, 0xc6, 0xf4, 0x9c, 0xa1, 0x68, 0x32, 0x85, 0x52, 0x35, 0x64, 0x30, 0x1d, - 0xec, 0xa1, 0x4b, 0xe9, 0x90, 0x21, 0x43, 0xd7, 0x14, 0xb7, 0x7b, 0x50, 0xec, 0x4b, 0x10, 0x28, - 0x3e, 0x21, 0x9d, 0x87, 0xbc, 0x65, 0x9f, 0x23, 0xd0, 0x77, 0x28, 0x96, 0x62, 0x68, 0xbb, 0xdd, - 0xdd, 0xff, 0x81, 0xf4, 0xfd, 0x20, 0x1b, 0xea, 0xd8, 0xa9, 0x86, 0x7d, 0x65, 0xf4, 0xae, 0xb2, - 0x8e, 0x98, 0x2a, 0x72, 0xaa, 0x31, 0x58, 0x86, 0x45, 0xcc, 0xe2, 0x76, 0x27, 0x0f, 0x44, 0x07, - 0x83, 0x11, 0xd9, 0xf5, 0xfb, 0xaa, 0x45, 0xdf, 0x38, 0x6d, 0x99, 0x5c, 0x24, 0x17, 0x5f, 0x09, - 0x64, 0x9b, 0x00, 0x7f, 0xb0, 0x62, 0x14, 0x0f, 0x90, 0xf9, 0x61, 0xd8, 0x5a, 0x47, 0xb4, 0xcf, - 0x13, 0x99, 0x14, 0xf3, 0x1a, 0xc2, 0xe9, 0x7d, 0xb8, 0x88, 0x25, 0xa4, 0xbd, 0x6d, 0x15, 0xa3, - 0xcb, 0xaf, 0x86, 0x70, 0x0d, 0xe7, 0x55, 0xaa, 0xda, 0xd6, 0xa1, 0xf7, 0xf5, 0x18, 0x89, 0x02, - 0xb2, 0x38, 0x6e, 0x59, 0x1f, 0x31, 0x9f, 0xc8, 0xa4, 0x98, 0xae, 0xd3, 0xf3, 0x6a, 0xda, 0xeb, - 0x8e, 0x6b, 0x88, 0xd9, 0xa7, 0x3e, 0xa2, 0x78, 0x82, 0x79, 0xd3, 0x3b, 0x87, 0x1d, 0x47, 0x74, - 0xfa, 0x17, 0xcd, 0x2e, 0x61, 0x60, 0x97, 0x90, 0x5a, 0xa3, 0x4e, 0xe8, 0x7c, 0x7e, 0x2d, 0x27, - 0xff, 0xdf, 0xbe, 0x44, 0x8b, 0xf5, 0x68, 0x14, 0x3f, 0xfc, 0x08, 0xf3, 0xd8, 0xc6, 0x36, 0x58, - 0x5c, 0x94, 0x32, 0xfa, 0x25, 0x7d, 0x0b, 0x13, 0xaf, 0x0f, 0xd1, 0xa7, 0x1e, 0xc6, 0xd7, 0x17, - 0x48, 0x3d, 0x19, 0x3e, 0x59, 0x14, 0xf7, 0x65, 0x2c, 0xb1, 0x1c, 0x4b, 0x2c, 0xdf, 0x34, 0x9a, - 0x76, 0x63, 0x59, 0x53, 0xe7, 0xf3, 0xef, 0x54, 0x26, 0xc5, 0x4d, 0x3d, 0xe2, 0xbb, 0x59, 0xc0, - 0x9e, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x9c, 0x0c, 0x8c, 0xa5, 0x01, 0x00, 0x00, -} diff --git a/app/singlesession.go b/app/singlesession.go deleted file mode 100644 index d0004be..0000000 --- a/app/singlesession.go +++ /dev/null @@ -1,533 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package app - -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" -) - -// 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 -) - -// ISingleSessionMetaData contains all meta data concerning the ISingleSession contract. -var ISingleSessionMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"seq\",\"type\":\"uint256\"}],\"name\":\"IntendSettle\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"name\":\"_stateProof\",\"type\":\"bytes\"}],\"name\":\"intendSettle\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSettleFinalizedTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_action\",\"type\":\"bytes\"}],\"name\":\"applyAction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getActionDeadline\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"finalizeOnActionTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSeqNum\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// ISingleSessionABI is the input ABI used to generate the binding from. -// Deprecated: Use ISingleSessionMetaData.ABI instead. -var ISingleSessionABI = ISingleSessionMetaData.ABI - -// ISingleSession is an auto generated Go binding around an Ethereum contract. -type ISingleSession struct { - ISingleSessionCaller // Read-only binding to the contract - ISingleSessionTransactor // Write-only binding to the contract - ISingleSessionFilterer // Log filterer for contract events -} - -// ISingleSessionCaller is an auto generated read-only Go binding around an Ethereum contract. -type ISingleSessionCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ISingleSessionTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ISingleSessionTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ISingleSessionFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ISingleSessionFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ISingleSessionSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ISingleSessionSession struct { - Contract *ISingleSession // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ISingleSessionCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ISingleSessionCallerSession struct { - Contract *ISingleSessionCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ISingleSessionTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ISingleSessionTransactorSession struct { - Contract *ISingleSessionTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ISingleSessionRaw is an auto generated low-level Go binding around an Ethereum contract. -type ISingleSessionRaw struct { - Contract *ISingleSession // Generic contract binding to access the raw methods on -} - -// ISingleSessionCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ISingleSessionCallerRaw struct { - Contract *ISingleSessionCaller // Generic read-only contract binding to access the raw methods on -} - -// ISingleSessionTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ISingleSessionTransactorRaw struct { - Contract *ISingleSessionTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewISingleSession creates a new instance of ISingleSession, bound to a specific deployed contract. -func NewISingleSession(address common.Address, backend bind.ContractBackend) (*ISingleSession, error) { - contract, err := bindISingleSession(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ISingleSession{ISingleSessionCaller: ISingleSessionCaller{contract: contract}, ISingleSessionTransactor: ISingleSessionTransactor{contract: contract}, ISingleSessionFilterer: ISingleSessionFilterer{contract: contract}}, nil -} - -// NewISingleSessionCaller creates a new read-only instance of ISingleSession, bound to a specific deployed contract. -func NewISingleSessionCaller(address common.Address, caller bind.ContractCaller) (*ISingleSessionCaller, error) { - contract, err := bindISingleSession(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ISingleSessionCaller{contract: contract}, nil -} - -// NewISingleSessionTransactor creates a new write-only instance of ISingleSession, bound to a specific deployed contract. -func NewISingleSessionTransactor(address common.Address, transactor bind.ContractTransactor) (*ISingleSessionTransactor, error) { - contract, err := bindISingleSession(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ISingleSessionTransactor{contract: contract}, nil -} - -// NewISingleSessionFilterer creates a new log filterer instance of ISingleSession, bound to a specific deployed contract. -func NewISingleSessionFilterer(address common.Address, filterer bind.ContractFilterer) (*ISingleSessionFilterer, error) { - contract, err := bindISingleSession(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ISingleSessionFilterer{contract: contract}, nil -} - -// bindISingleSession binds a generic wrapper to an already deployed contract. -func bindISingleSession(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ISingleSessionMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ISingleSession *ISingleSessionRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ISingleSession.Contract.ISingleSessionCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ISingleSession *ISingleSessionRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ISingleSession.Contract.ISingleSessionTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ISingleSession *ISingleSessionRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ISingleSession.Contract.ISingleSessionTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ISingleSession *ISingleSessionCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ISingleSession.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ISingleSession *ISingleSessionTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ISingleSession.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ISingleSession *ISingleSessionTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ISingleSession.Contract.contract.Transact(opts, method, params...) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xbbc35280. -// -// Solidity: function getActionDeadline() view returns(uint256) -func (_ISingleSession *ISingleSessionCaller) GetActionDeadline(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ISingleSession.contract.Call(opts, &out, "getActionDeadline") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xbbc35280. -// -// Solidity: function getActionDeadline() view returns(uint256) -func (_ISingleSession *ISingleSessionSession) GetActionDeadline() (*big.Int, error) { - return _ISingleSession.Contract.GetActionDeadline(&_ISingleSession.CallOpts) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xbbc35280. -// -// Solidity: function getActionDeadline() view returns(uint256) -func (_ISingleSession *ISingleSessionCallerSession) GetActionDeadline() (*big.Int, error) { - return _ISingleSession.Contract.GetActionDeadline(&_ISingleSession.CallOpts) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x6d15c457. -// -// Solidity: function getSeqNum() view returns(uint256) -func (_ISingleSession *ISingleSessionCaller) GetSeqNum(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ISingleSession.contract.Call(opts, &out, "getSeqNum") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x6d15c457. -// -// Solidity: function getSeqNum() view returns(uint256) -func (_ISingleSession *ISingleSessionSession) GetSeqNum() (*big.Int, error) { - return _ISingleSession.Contract.GetSeqNum(&_ISingleSession.CallOpts) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x6d15c457. -// -// Solidity: function getSeqNum() view returns(uint256) -func (_ISingleSession *ISingleSessionCallerSession) GetSeqNum() (*big.Int, error) { - return _ISingleSession.Contract.GetSeqNum(&_ISingleSession.CallOpts) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0xb71ca01f. -// -// Solidity: function getSettleFinalizedTime() view returns(uint256) -func (_ISingleSession *ISingleSessionCaller) GetSettleFinalizedTime(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _ISingleSession.contract.Call(opts, &out, "getSettleFinalizedTime") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0xb71ca01f. -// -// Solidity: function getSettleFinalizedTime() view returns(uint256) -func (_ISingleSession *ISingleSessionSession) GetSettleFinalizedTime() (*big.Int, error) { - return _ISingleSession.Contract.GetSettleFinalizedTime(&_ISingleSession.CallOpts) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0xb71ca01f. -// -// Solidity: function getSettleFinalizedTime() view returns(uint256) -func (_ISingleSession *ISingleSessionCallerSession) GetSettleFinalizedTime() (*big.Int, error) { - return _ISingleSession.Contract.GetSettleFinalizedTime(&_ISingleSession.CallOpts) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_ISingleSession *ISingleSessionCaller) GetState(opts *bind.CallOpts, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _ISingleSession.contract.Call(opts, &out, "getState", _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_ISingleSession *ISingleSessionSession) GetState(_key *big.Int) ([]byte, error) { - return _ISingleSession.Contract.GetState(&_ISingleSession.CallOpts, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_ISingleSession *ISingleSessionCallerSession) GetState(_key *big.Int) ([]byte, error) { - return _ISingleSession.Contract.GetState(&_ISingleSession.CallOpts, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_ISingleSession *ISingleSessionCaller) GetStatus(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _ISingleSession.contract.Call(opts, &out, "getStatus") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_ISingleSession *ISingleSessionSession) GetStatus() (uint8, error) { - return _ISingleSession.Contract.GetStatus(&_ISingleSession.CallOpts) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_ISingleSession *ISingleSessionCallerSession) GetStatus() (uint8, error) { - return _ISingleSession.Contract.GetStatus(&_ISingleSession.CallOpts) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0x1f2b71e5. -// -// Solidity: function applyAction(bytes _action) returns() -func (_ISingleSession *ISingleSessionTransactor) ApplyAction(opts *bind.TransactOpts, _action []byte) (*types.Transaction, error) { - return _ISingleSession.contract.Transact(opts, "applyAction", _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0x1f2b71e5. -// -// Solidity: function applyAction(bytes _action) returns() -func (_ISingleSession *ISingleSessionSession) ApplyAction(_action []byte) (*types.Transaction, error) { - return _ISingleSession.Contract.ApplyAction(&_ISingleSession.TransactOpts, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0x1f2b71e5. -// -// Solidity: function applyAction(bytes _action) returns() -func (_ISingleSession *ISingleSessionTransactorSession) ApplyAction(_action []byte) (*types.Transaction, error) { - return _ISingleSession.Contract.ApplyAction(&_ISingleSession.TransactOpts, _action) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xfa5e7ff5. -// -// Solidity: function finalizeOnActionTimeout() returns() -func (_ISingleSession *ISingleSessionTransactor) FinalizeOnActionTimeout(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ISingleSession.contract.Transact(opts, "finalizeOnActionTimeout") -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xfa5e7ff5. -// -// Solidity: function finalizeOnActionTimeout() returns() -func (_ISingleSession *ISingleSessionSession) FinalizeOnActionTimeout() (*types.Transaction, error) { - return _ISingleSession.Contract.FinalizeOnActionTimeout(&_ISingleSession.TransactOpts) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xfa5e7ff5. -// -// Solidity: function finalizeOnActionTimeout() returns() -func (_ISingleSession *ISingleSessionTransactorSession) FinalizeOnActionTimeout() (*types.Transaction, error) { - return _ISingleSession.Contract.FinalizeOnActionTimeout(&_ISingleSession.TransactOpts) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_ISingleSession *ISingleSessionTransactor) IntendSettle(opts *bind.TransactOpts, _stateProof []byte) (*types.Transaction, error) { - return _ISingleSession.contract.Transact(opts, "intendSettle", _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_ISingleSession *ISingleSessionSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _ISingleSession.Contract.IntendSettle(&_ISingleSession.TransactOpts, _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_ISingleSession *ISingleSessionTransactorSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _ISingleSession.Contract.IntendSettle(&_ISingleSession.TransactOpts, _stateProof) -} - -// ISingleSessionIntendSettleIterator is returned from FilterIntendSettle and is used to iterate over the raw logs and unpacked data for IntendSettle events raised by the ISingleSession contract. -type ISingleSessionIntendSettleIterator struct { - Event *ISingleSessionIntendSettle // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ISingleSessionIntendSettleIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ISingleSessionIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ISingleSessionIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ISingleSessionIntendSettleIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ISingleSessionIntendSettleIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ISingleSessionIntendSettle represents a IntendSettle event raised by the ISingleSession contract. -type ISingleSessionIntendSettle struct { - Seq *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIntendSettle is a free log retrieval operation binding the contract event 0xce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a. -// -// Solidity: event IntendSettle(uint256 seq) -func (_ISingleSession *ISingleSessionFilterer) FilterIntendSettle(opts *bind.FilterOpts) (*ISingleSessionIntendSettleIterator, error) { - - logs, sub, err := _ISingleSession.contract.FilterLogs(opts, "IntendSettle") - if err != nil { - return nil, err - } - return &ISingleSessionIntendSettleIterator{contract: _ISingleSession.contract, event: "IntendSettle", logs: logs, sub: sub}, nil -} - -// WatchIntendSettle is a free log subscription operation binding the contract event 0xce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a. -// -// Solidity: event IntendSettle(uint256 seq) -func (_ISingleSession *ISingleSessionFilterer) WatchIntendSettle(opts *bind.WatchOpts, sink chan<- *ISingleSessionIntendSettle) (event.Subscription, error) { - - logs, sub, err := _ISingleSession.contract.WatchLogs(opts, "IntendSettle") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ISingleSessionIntendSettle) - if err := _ISingleSession.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIntendSettle is a log parse operation binding the contract event 0xce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a. -// -// Solidity: event IntendSettle(uint256 seq) -func (_ISingleSession *ISingleSessionFilterer) ParseIntendSettle(log types.Log) (*ISingleSessionIntendSettle, error) { - event := new(ISingleSessionIntendSettle) - if err := _ISingleSession.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/app/singlesessionwithoracle.go b/app/singlesessionwithoracle.go deleted file mode 100644 index aeef7c4..0000000 --- a/app/singlesessionwithoracle.go +++ /dev/null @@ -1,327 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package app - -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" -) - -// 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 -) - -// ISingleSessionWithOracleMetaData contains all meta data concerning the ISingleSessionWithOracle contract. -var ISingleSessionWithOracleMetaData = &bind.MetaData{ - ABI: "[{\"constant\":true,\"inputs\":[{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleBySigTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleByMoveTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidTurn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - -// ISingleSessionWithOracleABI is the input ABI used to generate the binding from. -// Deprecated: Use ISingleSessionWithOracleMetaData.ABI instead. -var ISingleSessionWithOracleABI = ISingleSessionWithOracleMetaData.ABI - -// ISingleSessionWithOracle is an auto generated Go binding around an Ethereum contract. -type ISingleSessionWithOracle struct { - ISingleSessionWithOracleCaller // Read-only binding to the contract - ISingleSessionWithOracleTransactor // Write-only binding to the contract - ISingleSessionWithOracleFilterer // Log filterer for contract events -} - -// ISingleSessionWithOracleCaller is an auto generated read-only Go binding around an Ethereum contract. -type ISingleSessionWithOracleCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ISingleSessionWithOracleTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ISingleSessionWithOracleTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ISingleSessionWithOracleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ISingleSessionWithOracleFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ISingleSessionWithOracleSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ISingleSessionWithOracleSession struct { - Contract *ISingleSessionWithOracle // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ISingleSessionWithOracleCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ISingleSessionWithOracleCallerSession struct { - Contract *ISingleSessionWithOracleCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ISingleSessionWithOracleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ISingleSessionWithOracleTransactorSession struct { - Contract *ISingleSessionWithOracleTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ISingleSessionWithOracleRaw is an auto generated low-level Go binding around an Ethereum contract. -type ISingleSessionWithOracleRaw struct { - Contract *ISingleSessionWithOracle // Generic contract binding to access the raw methods on -} - -// ISingleSessionWithOracleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ISingleSessionWithOracleCallerRaw struct { - Contract *ISingleSessionWithOracleCaller // Generic read-only contract binding to access the raw methods on -} - -// ISingleSessionWithOracleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ISingleSessionWithOracleTransactorRaw struct { - Contract *ISingleSessionWithOracleTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewISingleSessionWithOracle creates a new instance of ISingleSessionWithOracle, bound to a specific deployed contract. -func NewISingleSessionWithOracle(address common.Address, backend bind.ContractBackend) (*ISingleSessionWithOracle, error) { - contract, err := bindISingleSessionWithOracle(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &ISingleSessionWithOracle{ISingleSessionWithOracleCaller: ISingleSessionWithOracleCaller{contract: contract}, ISingleSessionWithOracleTransactor: ISingleSessionWithOracleTransactor{contract: contract}, ISingleSessionWithOracleFilterer: ISingleSessionWithOracleFilterer{contract: contract}}, nil -} - -// NewISingleSessionWithOracleCaller creates a new read-only instance of ISingleSessionWithOracle, bound to a specific deployed contract. -func NewISingleSessionWithOracleCaller(address common.Address, caller bind.ContractCaller) (*ISingleSessionWithOracleCaller, error) { - contract, err := bindISingleSessionWithOracle(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ISingleSessionWithOracleCaller{contract: contract}, nil -} - -// NewISingleSessionWithOracleTransactor creates a new write-only instance of ISingleSessionWithOracle, bound to a specific deployed contract. -func NewISingleSessionWithOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*ISingleSessionWithOracleTransactor, error) { - contract, err := bindISingleSessionWithOracle(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ISingleSessionWithOracleTransactor{contract: contract}, nil -} - -// NewISingleSessionWithOracleFilterer creates a new log filterer instance of ISingleSessionWithOracle, bound to a specific deployed contract. -func NewISingleSessionWithOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*ISingleSessionWithOracleFilterer, error) { - contract, err := bindISingleSessionWithOracle(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ISingleSessionWithOracleFilterer{contract: contract}, nil -} - -// bindISingleSessionWithOracle binds a generic wrapper to an already deployed contract. -func bindISingleSessionWithOracle(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ISingleSessionWithOracleMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ISingleSessionWithOracle *ISingleSessionWithOracleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ISingleSessionWithOracle.Contract.ISingleSessionWithOracleCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ISingleSessionWithOracle *ISingleSessionWithOracleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.ISingleSessionWithOracleTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ISingleSessionWithOracle *ISingleSessionWithOracleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.ISingleSessionWithOracleTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_ISingleSessionWithOracle *ISingleSessionWithOracleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _ISingleSessionWithOracle.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.contract.Transact(opts, method, params...) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_ISingleSessionWithOracle *ISingleSessionWithOracleCaller) GetState(opts *bind.CallOpts, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _ISingleSessionWithOracle.contract.Call(opts, &out, "getState", _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_ISingleSessionWithOracle *ISingleSessionWithOracleSession) GetState(_key *big.Int) ([]byte, error) { - return _ISingleSessionWithOracle.Contract.GetState(&_ISingleSessionWithOracle.CallOpts, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_ISingleSessionWithOracle *ISingleSessionWithOracleCallerSession) GetState(_key *big.Int) ([]byte, error) { - return _ISingleSessionWithOracle.Contract.GetState(&_ISingleSessionWithOracle.CallOpts, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_ISingleSessionWithOracle *ISingleSessionWithOracleCaller) GetStatus(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _ISingleSessionWithOracle.contract.Call(opts, &out, "getStatus") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_ISingleSessionWithOracle *ISingleSessionWithOracleSession) GetStatus() (uint8, error) { - return _ISingleSessionWithOracle.Contract.GetStatus(&_ISingleSessionWithOracle.CallOpts) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_ISingleSessionWithOracle *ISingleSessionWithOracleCallerSession) GetStatus() (uint8, error) { - return _ISingleSessionWithOracle.Contract.GetStatus(&_ISingleSessionWithOracle.CallOpts) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactor) SettleByInvalidState(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.contract.Transact(opts, "settleByInvalidState", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleByInvalidState(&_ISingleSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactorSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleByInvalidState(&_ISingleSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactor) SettleByInvalidTurn(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.contract.Transact(opts, "settleByInvalidTurn", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleByInvalidTurn(&_ISingleSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactorSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleByInvalidTurn(&_ISingleSessionWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactor) SettleByMoveTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.contract.Transact(opts, "settleByMoveTimeout", _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleByMoveTimeout(&_ISingleSessionWithOracle.TransactOpts, _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactorSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleByMoveTimeout(&_ISingleSessionWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactor) SettleBySigTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.contract.Transact(opts, "settleBySigTimeout", _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleBySigTimeout(&_ISingleSessionWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_ISingleSessionWithOracle *ISingleSessionWithOracleTransactorSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _ISingleSessionWithOracle.Contract.SettleBySigTimeout(&_ISingleSessionWithOracle.TransactOpts, _oracleProof) -} diff --git a/celersdk/api.go b/celersdk/api.go index bace401..6800c1e 100644 --- a/celersdk/api.go +++ b/celersdk/api.go @@ -207,9 +207,9 @@ func (mc *Client) GetChannelState(tk *Token) string { // can update UI and/or try open again. // Note pending true is only possible for client iniated onchain openchannel, not TCB // -// Internally we save the blockNum when start openchan request, if current blockNum <= saved+OpenChannelTimeout -// we return true. The value is set to 0 in openchan callback so future calls will -// return false (assume real blkNum is much larger than OpenChannelTimeout) +// Internally we save the unix timestamp (seconds) when an openchan request starts; if +// time.Now().Unix() <= saved+OpenChannelTimeout we return true. The value is set to 0 in the +// openchan callback so future calls return false. func (mc *Client) HasPendingOpenChanRequest(tk *Token) bool { return mc.c.HasPendingOpenChanRequest(sdkToken2entityToken(tk)) } diff --git a/celersdk/appsession.go b/celersdk/appsession.go index 79f135b..09cbe8f 100644 --- a/celersdk/appsession.go +++ b/celersdk/appsession.go @@ -1,397 +1,72 @@ // Copyright 2018-2025 Celer Network -// SDK APIs dealing with app channels, ie. app session +// SDK APIs dealing with app sessions backed by stateless `IBooleanCond` +// virtual condition contracts. +// +// Post-trim the legacy gaming surface (turn-based state-exchange protocol with +// `SignAppData` / `HandleMatchData` / opcodes / seqnum tracking, on-chain +// `applyAction` / introspection / oracle disputes, the `NewAppSessionOnDeployedContract` +// path and its multisession dependencies) is gone. What remains is the thin +// wrapper around `client.CelerClient`'s registration / outcome-query surface +// for VIRTUAL_CONTRACT condition contracts. package celersdk import ( - "bytes" - "encoding/binary" - "errors" - "math/big" - "sort" - "strings" - - "github.com/celer-network/agent-pay/app" "github.com/celer-network/agent-pay/client" - "github.com/celer-network/agent-pay/common" "github.com/celer-network/agent-pay/ctype" - "github.com/celer-network/goutils/log" - "github.com/ethereum/go-ethereum/crypto" - "go.uber.org/atomic" ) -const NUM_PLAYERS = 2 - -var ( - ErrMissingSigs = errors.New("missing sigs from received ack msg") - ErrDiffAckState = errors.New("ack msg has different state") - ErrWrongSeqNum = errors.New("wrong seqnum") - ErrDiffAppState = errors.New("appstate is different") - ErrWrongOpcode = errors.New("unknown opcode") - ErrWrongPlayers = errors.New("players list is wrong") - ErrWrongNonce = errors.New("wrong nonce") - ErrWrongOnChainTimeout = errors.New("wrong onchain timeout") - ErrInvalidSession = errors.New("invalid app session ") -) - -type AppInfo struct { - DeployedAddr string - ContractBin string - OnChainTimeout int64 - Callback AppCallback -} -type AppCallback interface { - common.StateCallback -} - type AppSession struct { ID string - // TODO(mzhou): MyIdx should not be enforced - MyIdx int64 // MyIdx in this appsession, eg. 0 if I'm black on gomoku - cc *client.CelerClient - seqnum *atomic.Uint64 // maintain seqnum and update on send/recv - lastSentState []byte - lastRecvState []byte - // expectNewStateFromPeer indicates whether I'm expecting to receive new state from peer - // default true, set to false after receive new state and set to true after signappdata - expectNewStateFromPeer *atomic.Bool -} - -// newAppSession creates a new CApp session and return the session identifier as string -func (mc *Client) newAppSession(capp *AppInfo, constructor string, nonce int64) (string, error) { - return mc.c.NewAppChannelOnVirtualContract( - ctype.Hex2Bytes(capp.ContractBin), - ctype.Hex2Bytes(constructor), - uint64(nonce), - uint64(capp.OnChainTimeout), - capp.Callback) + cc *client.CelerClient } +// CreateAppSessionOnVirtualContract registers a VIRTUAL_CONTRACT condition +// contract on the cnode and returns an `AppSession` keyed by its deterministic +// virtual-contract address. The contract is deployed lazily on first outcome +// query (via `OnChainGetBooleanOutcome`). func (mc *Client) CreateAppSessionOnVirtualContract( contractBin string, constructor string, - nonce uint64, - onChainTimeout uint64, - callback AppCallback) (*AppSession, error) { + nonce uint64) (*AppSession, error) { sessionID, err := mc.c.NewAppChannelOnVirtualContract( ctype.Hex2Bytes(contractBin), ctype.Hex2Bytes(constructor), - nonce, - onChainTimeout, - callback) - if err != nil { - return nil, err - } - return &AppSession{ - ID: sessionID, - MyIdx: 0, // dummy - cc: mc.c, - seqnum: atomic.NewUint64(0), - expectNewStateFromPeer: atomic.NewBool(true), - }, nil -} - -func (mc *Client) CreateAppSessionOnDeployedContract( - contractAddress string, - nonce uint64, - onChainTimeout uint64, - participants string, - callback AppCallback) (*AppSession, error) { - var participantAddrs []ctype.Addr - splitted := strings.Split(participants, ",") - for _, participant := range splitted { - participantAddrs = append(participantAddrs, ctype.Hex2Addr(participant)) - } - sessionID, err := mc.c.NewAppChannelOnDeployedContract( - ctype.Hex2Addr(contractAddress), - nonce, - participantAddrs, - onChainTimeout, - callback) - if err != nil { - return nil, err - } - return &AppSession{ - ID: sessionID, - MyIdx: 0, // dummy - cc: mc.c, - seqnum: atomic.NewUint64(0), - expectNewStateFromPeer: atomic.NewBool(true), - }, nil -} - -func (mc *Client) EndAppSession(sessionid string) error { - return mc.c.DeleteAppChannel(sessionid) -} - -// NewAppSession creates app session object for deployed contract -// deployedAddr is eth address bytes of deployed app contract -// matchid is the matchid string from nakama server -// players is players ETH addresses seperated by comma, eg: ab...12,bc...23 -// due to gobind type limitation. -// return AppSession and AppSession.ID can be used to end session -func (mc *Client) NewAppSessionOnDeployedContract(capp *AppInfo, matchid string, players string) (*AppSession, error) { - contractAddr := ctype.Hex2Addr(capp.DeployedAddr) - nonce := binary.BigEndian.Uint64(crypto.Keccak256([]byte(matchid))) - var plist []ctype.Addr - p := strings.Split(players, ",") - for _, i := range p { - plist = append(plist, ctype.Hex2Addr(i)) - } - if len(plist) != NUM_PLAYERS { - return nil, ErrWrongPlayers - } - // Fair algo for assigning myidx, assume nonce is sufficiently random, need to ensure two clients see different - // MyIdx based on same nonce. So we sort player by address(to ensure both clients see same), then pick nonce%2 in the players list - // as idx 0, the other addr is idx 1. Compare my own address with it to get MyIdx - sortedPlayers := app.SortPlayers(plist) - idx1addr := sortedPlayers[nonce%NUM_PLAYERS] - var myidx int64 - if idx1addr == mc.c.MyAddress() { - myidx = 0 - } else { - myidx = 1 - } - - sid, err := mc.c.NewAppChannelOnDeployedContract( - contractAddr, nonce, plist, uint64(capp.OnChainTimeout), capp.Callback) + nonce) if err != nil { return nil, err } - return &AppSession{ - ID: sid, - MyIdx: myidx, - cc: mc.c, - seqnum: atomic.NewUint64(0), - expectNewStateFromPeer: atomic.NewBool(true), - }, nil + return &AppSession{ID: sessionID, cc: mc.c}, nil } -// SignAppData takes app data, add proper metadata and return final bytes ready to be sent via nakama -// note this func will incr session seq number and set expect new state from peer to true -func (s *AppSession) SignAppData(in []byte) ([]byte, error) { - newseq := s.seqnum.Inc() - s.expectNewStateFromPeer.Store(true) - serialized, sig, err := s.cc.SignAppState(s.ID, newseq, in) - if err != nil { - return nil, err - } - s.lastSentState = serialized - return app.EncodeAppStateProof(serialized, [][]byte{sig}) -} - -// AppData has 2 fields, Received is to be passed to celerx -// AckMsg is to be sent via nakama with opcode OPCODE_ACK -type AppData struct { - Received []byte - AckMsg []byte +// EndAppSession removes the registered virtual condition contract from the +// cnode's in-memory bookkeeping. The current implementation always succeeds; +// it cannot fail. +func (mc *Client) EndAppSession(sessionid string) { + mc.c.DeleteAppChannel(sessionid) } -const ( - OPCODE_NEWSTATE = 1 - OPCODE_ACK = 2 -) - -// HandleMatchData process received matchdata via nakama -// opcode 1: new state with one sig -// opcode 2: ack msg with new sig appended -// data should be bytes of AppStateProof -// for opcode 2, *AppData is empty, just check error -// for opcode 1, if *AppData isn't nil, both fields should be set -func (s *AppSession) HandleMatchData(opcode int, data []byte) (*AppData, error) { - appstate, sigs, err := app.DecodeAppStateProof(data) - if err != nil { - return nil, err - } - switch opcode { - case OPCODE_ACK: - if len(sigs) != NUM_PLAYERS { // only work for 1v1 now - return nil, ErrMissingSigs - } - if !bytes.Equal(s.lastSentState, appstate) { - log.Errorf("%s expect:%x recv:%x", ErrDiffAckState, s.lastSentState, appstate) - return nil, ErrDiffAckState - } - return new(AppData), nil - case OPCODE_NEWSTATE: - nonce, seqn, recv, timeout, err := app.DecodeAppState(appstate) - if err != nil { - return nil, err - } - appChannel := s.cc.GetAppChannel(s.ID) - if appChannel == nil { - log.Error(ErrInvalidSession) - return nil, ErrInvalidSession - } - if nonce != appChannel.Nonce { - log.Errorf("%s expect:%d recv:%d", ErrWrongSeqNum, appChannel.Nonce, nonce) - return nil, ErrWrongNonce - } - if timeout != appChannel.OnChainTimeout { - log.Errorf("%s expect:%d recv:%d", ErrWrongOnChainTimeout, appChannel.OnChainTimeout, timeout) - return nil, ErrWrongOnChainTimeout - } - myseq := s.seqnum.Load() - isExpect := s.expectNewStateFromPeer.Load() - if !isExpect { - // not expecting msg, consider this is due to peer re-send last state - // myseq already incr in last recv so seqn should be the same - if seqn != myseq { - log.Errorf("%s expect:%d recv:%d", ErrWrongSeqNum, myseq, seqn) - return nil, ErrWrongSeqNum - } - if !bytes.Equal(recv, s.lastRecvState) { - log.Errorf("%s expect:%x recv:%x", ErrDiffAppState, s.lastRecvState, recv) - return nil, ErrDiffAppState - } - } else { - // expect new state, seqn must be myseq+1 - if seqn != myseq+1 { - log.Errorf("%s expect:%d recv:%d", ErrWrongSeqNum, myseq+1, seqn) - return nil, ErrWrongSeqNum - } - s.lastRecvState = recv - s.seqnum.Store(seqn) - } - s.expectNewStateFromPeer.Store(false) - - appstate2, mysig, err := s.cc.SignAppState(s.ID, seqn, recv) - if !bytes.Equal(appstate, appstate2) { - log.Errorf("%s recv:%x tosend:%x", ErrDiffAppState, appstate, appstate2) - return nil, ErrDiffAppState - } - sigs = append(sigs, mysig) - ackMsg, err := app.EncodeAppStateProof(appstate, sigs) - if err != nil { - log.Error(err) - return nil, err - } - return &AppData{ - Received: recv, - AckMsg: ackMsg, - }, nil - default: - return nil, ErrWrongOpcode - } -} - -// GetPlayerIdxForMatch returns a player idx (0 based) for myaddr. myaddr must be in players. -// players is ETH addresses seperated by comma, eg: ab...12,bc...23 -// it uses a fair algo for assigning myidx, based on a number generated from matchid -// players list is sorted first for consistency -// return -1 on err -func GetPlayerIdxForMatch(matchid, myaddr, players string) int64 { - nonce := binary.BigEndian.Uint64(crypto.Keccak256([]byte(matchid))) - var plist []ctype.Addr - p := strings.Split(players, ",") - for _, i := range p { - plist = append(plist, ctype.Hex2Addr(i)) - } - if len(p) < 2 { - log.Error("too few players: ", len(p)) - return -1 - } - // sort plist in place - sort.Slice(plist, func(i, j int) bool { return bytes.Compare(plist[i].Bytes(), plist[j].Bytes()) < 0 }) - // rearrange plist so cutIdx becomes 0 - cutIdx := nonce % uint64(len(p)) - plist = append(plist[cutIdx:], plist[0:cutIdx]...) - my := ctype.Hex2Addr(myaddr) - for i, a := range plist { - if a == my { - return int64(i) - } - } - log.Error("not found in players: ", myaddr) - return -1 -} - -// -------------------- Switch to Onchain ------------------- - -// SwitchToOnchain submits offchain stateproof to onchain and starts onchain play -func (s *AppSession) SwitchToOnchain(stateproof []byte) error { - return s.cc.SettleAppChannel(s.ID, stateproof) -} - -// GetDeployedAddress get the depolyed address of the app -// returns error if the app is based on an undeployed virtual contract +// GetDeployedAddress returns the on-chain deployed address of the registered +// virtual condition contract. Returns an error if the contract has not been +// deployed yet (deployment is triggered lazily by `OnChainGetBooleanOutcome`). func (s *AppSession) GetDeployedAddress() (string, error) { addr, err := s.cc.GetAppChannelDeployedAddr(s.ID) return ctype.Addr2Hex(addr), err } -// AppBooleanOutcome has two fields -// Finalized: if the app is finalized -// Outcome: the boolean outcome with given query arg +// AppBooleanOutcome carries the result of an `IBooleanCond` query: whether the +// outcome has been finalized, and the boolean outcome itself. type AppBooleanOutcome struct { Finalized bool Outcome bool } -// OnChainGetBooleanOutcome returns app boolean outcome +// OnChainGetBooleanOutcome queries `IBooleanCond.{isFinalized,getOutcome}` on +// the registered condition contract. For VIRTUAL_CONTRACT this triggers +// deploy-on-query: if the virtual contract has not been deployed yet, this call +// submits a deployment transaction first. func (s *AppSession) OnChainGetBooleanOutcome(query []byte) (*AppBooleanOutcome, error) { finalized, outcome, err := s.cc.OnChainGetAppChannelBooleanOutcome(s.ID, query) - boolres := AppBooleanOutcome{Finalized: finalized, Outcome: outcome} - return &boolres, err -} - -// OnChainApplyAction applies an action on chain -func (s *AppSession) OnChainApplyAction(action []byte) error { - return s.cc.OnChainApplyAppChannelAction(s.ID, action) -} - -// OnChainFinalizeOnActionTimeout finalizes the app on action timeout -func (s *AppSession) OnChainFinalizeOnActionTimeout() error { - return s.cc.OnChainFinalizeAppChannelOnActionTimeout(s.ID) -} - -// OnChainGetSettleFinalizedTime gets the app onchain settle finalized time -func (s *AppSession) OnChainGetSettleFinalizedTime() (int64, error) { - blkNum, err := s.cc.OnChainGetAppChannelSettleFinalizedTime(s.ID) - return int64(blkNum), err -} - -// OnChainGetActionDeadline gets the app onchain action deadline -func (s *AppSession) OnChainGetActionDeadline() (int64, error) { - blkNum, err := s.cc.OnChainGetAppChannelActionDeadline(s.ID) - return int64(blkNum), err -} - -// OnChainGetStatus gets the app onchain status (0:IDLE, 1:SETTLE, 2:ACTION, 3:FINALIZED) -func (s *AppSession) OnChainGetStatus() (int8, error) { - status, err := s.cc.OnChainGetAppChannelStatus(s.ID) - return int8(status), err -} - -// OnChainGetState gets the app onchain state associated with the given key -func (s *AppSession) OnChainGetState(key int64) ([]byte, error) { - bigkey := big.NewInt(key) - return s.cc.OnChainGetAppChannelState(s.ID, bigkey) -} - -// OnChainGetSeqNum gets the app onchain sequence number -func (s *AppSession) OnChainGetSeqNum() (int64, error) { - seq, err := s.cc.OnChainGetAppChannelSeqNum(s.ID) - return int64(seq), err -} - -// SettleBySigTimeout settle an app channel due to signature timeout -func (s *AppSession) SettleBySigTimeout(oracleProof []byte) error { - return s.cc.SettleAppChannelBySigTimeout(s.ID, oracleProof) -} - -// SettleByMoveTimeout settle an app channel due to movement timeout -func (s *AppSession) SettleByMoveTimeout(oracleProof []byte) error { - return s.cc.SettleAppChannelByMoveTimeout(s.ID, oracleProof) -} - -// SettleByInvalidTurn settle an app channel due to invalid turn -func (s *AppSession) SettleByInvalidTurn(oracleProof []byte, cosignedStateProof []byte) error { - return s.cc.SettleAppChannelByInvalidTurn(s.ID, oracleProof, cosignedStateProof) -} - -// SettleByInvalidState settle an app channel due to invalid state -func (s *AppSession) SettleByInvalidState(oracleProof []byte, cosignedStateProof []byte) error { - return s.cc.SettleAppChannelByInvalidState(s.ID, oracleProof, cosignedStateProof) + return &AppBooleanOutcome{Finalized: finalized, Outcome: outcome}, err } diff --git a/celersdk/pay.go b/celersdk/pay.go index 11c6c76..20bc8de 100644 --- a/celersdk/pay.go +++ b/celersdk/pay.go @@ -6,6 +6,7 @@ package celersdk import ( "errors" + "time" "github.com/celer-network/agent-pay/celersdkintf" "github.com/celer-network/agent-pay/common" @@ -17,7 +18,7 @@ import ( "google.golang.org/protobuf/types/known/anypb" ) -const cPayTimeout = 50 // timeout in blocknum for cpay ie. no app channel condition +const cPayTimeout = 600 // timeout in seconds for cpay ie. no app channel condition // noteTypeUrl should be type url of any.Any. // noteStr should be string representation of []byte in note (any.Any) @@ -34,7 +35,7 @@ func (mc *Client) SendToken(tk *Token, receiver string, amtWei string, noteTypeU Value: noteValueByte, } payID, err := mc.c.AddBooleanPay( - xfer, []*entity.Condition{}, mc.c.GetCurrentBlockNumberUint64()+cPayTimeout, note, 0) + xfer, []*entity.Condition{}, uint64(time.Now().Unix())+cPayTimeout, note, 0) if err != nil { log.Errorln("SendToken:", err) return ctype.ZeroPayIDHex, err @@ -52,8 +53,8 @@ func (mc *Client) SendETHWithCondition(receiver string, amtWei string, cond *Boo func (mc *Client) SendTokenWithCondition(tk *Token, receiver string, amtWei string, cond *BooleanCondition) (string, error) { xfer := createXfer(tk, receiver, amtWei) timeout := cPayTimeout - if cond.TimeoutBlockNum > 0 { - timeout = cond.TimeoutBlockNum + if cond.TimeoutSec > 0 { + timeout = cond.TimeoutSec } condition, err := bc2c(cond) if err != nil { @@ -61,7 +62,7 @@ func (mc *Client) SendTokenWithCondition(tk *Token, receiver string, amtWei stri return ctype.ZeroPayIDHex, err } payID, err := mc.c.AddBooleanPay( - xfer, []*entity.Condition{condition}, mc.c.GetCurrentBlockNumberUint64()+uint64(timeout), nil /*note*/, 0) + xfer, []*entity.Condition{condition}, uint64(time.Now().Unix())+uint64(timeout), nil /*note*/, 0) if err != nil { log.Errorln("SendTokenWithCondition:", err) return ctype.ZeroPayIDHex, err @@ -87,7 +88,16 @@ func (mc *Client) RemoveExpiredPays(tk *Token) error { return mc.c.SettleExpiredPays(token) } -// ResolvePayOnChain settles the payment onchain and receives the payment from OSP +// ResolvePayOnChain settles the payment onchain and receives the payment from OSP. +// +// VIRTUAL_CONTRACT prerequisite: PayResolver.resolvePaymentByConditions calls +// VirtContractResolver.resolve(virtAddr) on-chain, which reverts with +// "Nonexistent virtual address" if the virtual condition contract has not been +// deployed yet. The surviving deploy path is the deploy-on-query side effect +// of AppSession.OnChainGetBooleanOutcome — calling it once after registration +// (e.g. with a no-op query) ensures the virtual contract has bytecode by the +// time this resolve tx lands. DEPLOYED_CONTRACT conditions have no such +// prerequisite. func (mc *Client) ResolvePayOnChain(payID string) error { err := mc.c.ResolveCondPayOnChain(ctype.Hex2PayID(payID)) if err != nil { @@ -133,6 +143,9 @@ func (mc *Client) GetOnChainPaymentInfo(paymentID string) (*OnChainPaymentInfo, return &OnChainPaymentInfo{Amount: amount.String(), ResolveDeadline: resolveDeadline}, nil } +// ResolveIncomingPaymentOnChain submits PayResolver.resolvePaymentByConditions +// for the given payment. See ResolvePayOnChain doc for the VIRTUAL_CONTRACT +// deploy-before-resolve prerequisite — the same applies here. func (mc *Client) ResolveIncomingPaymentOnChain(payId string) error { return mc.c.ResolveCondPayOnChain(ctype.Hex2PayID(payId)) } @@ -170,7 +183,7 @@ func (mc *Client) SendConditionalPayment( payID, err := mc.c.AddBooleanPay( transfer, entityConditions, - mc.c.GetCurrentBlockNumberUint64()+uint64(timeout), + uint64(time.Now().Unix())+uint64(timeout), note, 0) if err != nil { log.Error(err) diff --git a/celersdk/types.go b/celersdk/types.go index 2786729..df89e5c 100644 --- a/celersdk/types.go +++ b/celersdk/types.go @@ -65,11 +65,11 @@ type Balance struct { } type BooleanCondition struct { - OnChainDeployed bool - OnChainAddress string // onchain contract address if OnChainDeployed is true - SessionID string // offchain session hex string from NewAppSession - ArgsForQueryOutcome []byte - TimeoutBlockNum int // timeout of one session. add current block num for pay deadline + OnChainDeployed bool + OnChainAddress string // on-chain IBooleanCond contract address if OnChainDeployed is true + VirtualContractAddress string // deterministic virtual-contract address (hex) from CreateAppSessionOnVirtualContract; ignored if OnChainDeployed is true + ArgsForQueryOutcome []byte + TimeoutSec int // pay deadline = wall-clock unix time + TimeoutSec } type Token struct { diff --git a/celersdk/utils.go b/celersdk/utils.go index d7e56cd..a394495 100644 --- a/celersdk/utils.go +++ b/celersdk/utils.go @@ -7,7 +7,6 @@ import ( "math/rand" "sync" - "github.com/celer-network/agent-pay/app" "github.com/celer-network/agent-pay/celersdkintf" "github.com/celer-network/agent-pay/client" "github.com/celer-network/agent-pay/common" @@ -15,7 +14,6 @@ import ( "github.com/celer-network/agent-pay/entity" "github.com/celer-network/agent-pay/utils" "github.com/celer-network/goutils/log" - "google.golang.org/protobuf/proto" ) // newClient creates a new Celer Client based on provided config @@ -57,30 +55,18 @@ func createXfer(tk *Token, receiver, amtWei string) *entity.TokenTransfer { } func bc2c(bc *BooleanCondition) (*entity.Condition, error) { - var cond *entity.Condition if bc.OnChainDeployed { - sessionQuery := &app.SessionQuery{ - Session: ctype.Hex2Bytes(bc.SessionID), - Query: bc.ArgsForQueryOutcome, - } - seralizedSessionQuery, err := proto.Marshal(sessionQuery) - if err != nil { - return nil, err - } - cond = &entity.Condition{ + return &entity.Condition{ ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, DeployedContractAddress: ctype.Hex2Addr(bc.OnChainAddress).Bytes(), - ArgsQueryFinalization: ctype.Hex2Bytes(bc.SessionID), - ArgsQueryOutcome: seralizedSessionQuery, - } - } else { - cond = &entity.Condition{ - ConditionType: entity.ConditionType_VIRTUAL_CONTRACT, - VirtualContractAddress: ctype.Hex2Bytes(bc.SessionID), - ArgsQueryOutcome: bc.ArgsForQueryOutcome, - } + ArgsQueryOutcome: bc.ArgsForQueryOutcome, + }, nil } - return cond, nil + return &entity.Condition{ + ConditionType: entity.ConditionType_VIRTUAL_CONTRACT, + VirtualContractAddress: ctype.Hex2Bytes(bc.VirtualContractAddress), + ArgsQueryOutcome: bc.ArgsForQueryOutcome, + }, nil } func sdkToken2entityToken(tk *Token) *entity.TokenInfo { diff --git a/chain/chain.pb.go b/chain/chain.pb.go index 26810eb..67ae509 100644 --- a/chain/chain.pb.go +++ b/chain/chain.pb.go @@ -1,4 +1,4 @@ -// Copyright 2018-2025 Celer Network +// Copyright 2018-2026 Celer Network // Code generated by protoc-gen-go. DO NOT EDIT. // versions: diff --git a/chain/channel-eth-go/balancelimit/balancelimit.go b/chain/channel-eth-go/balancelimit/balancelimit.go index 0da7c1d..8a71e42 100644 --- a/chain/channel-eth-go/balancelimit/balancelimit.go +++ b/chain/channel-eth-go/balancelimit/balancelimit.go @@ -32,7 +32,7 @@ var ( // LedgerBalanceLimitMetaData contains all meta data concerning the LedgerBalanceLimit contract. var LedgerBalanceLimitMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x610381610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610610060575f3560e01c80635930e0e1146100645780636ad1dc2d1461008d5780636ae97472146100b7578063bdca79a7146100e4578063c88c62651461011e575b5f5ffd5b81801561006f575f5ffd5b5061008b61007e3660046101fa565b600501805460ff19169055565b005b818015610098575f5ffd5b5061008b6100a73660046101fa565b600501805460ff19166001179055565b6100cf6100c53660046101fa565b6005015460ff1690565b60405190151581526020015b60405180910390f35b6101106100f236600461022c565b6001600160a01b03165f908152600491909101602052604090205490565b6040519081526020016100db565b818015610129575f5ffd5b5061008b61013836600461029e565b8281146101825760405162461bcd60e51b8152602060048201526014602482015273098cadccee8d0e640c8de40dcdee840dac2e8c6d60631b604482015260640160405180910390fd5b5f5b838110156101f25782828281811061019e5761019e610317565b90506020020135866004015f8787858181106101bc576101bc610317565b90506020020160208101906101d1919061032b565b6001600160a01b0316815260208101919091526040015f2055600101610184565b505050505050565b5f6020828403121561020a575f5ffd5b5035919050565b80356001600160a01b0381168114610227575f5ffd5b919050565b5f5f6040838503121561023d575f5ffd5b8235915061024d60208401610211565b90509250929050565b5f5f83601f840112610266575f5ffd5b50813567ffffffffffffffff81111561027d575f5ffd5b6020830191508360208260051b8501011115610297575f5ffd5b9250929050565b5f5f5f5f5f606086880312156102b2575f5ffd5b85359450602086013567ffffffffffffffff8111156102cf575f5ffd5b6102db88828901610256565b909550935050604086013567ffffffffffffffff8111156102fa575f5ffd5b61030688828901610256565b969995985093965092949392505050565b634e487b7160e01b5f52603260045260245ffd5b5f6020828403121561033b575f5ffd5b61034482610211565b939250505056fea2646970667358221220ab5ad22cd7ae35bc2fcb21395ae1394135531ebe6f347a679914b9f9e401c61464736f6c634300081d0033", + Bin: "0x610381610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610610060575f3560e01c80635930e0e1146100645780636ad1dc2d1461008d5780636ae97472146100b7578063bdca79a7146100e4578063c88c62651461011e575b5f5ffd5b81801561006f575f5ffd5b5061008b61007e3660046101fa565b600501805460ff19169055565b005b818015610098575f5ffd5b5061008b6100a73660046101fa565b600501805460ff19166001179055565b6100cf6100c53660046101fa565b6005015460ff1690565b60405190151581526020015b60405180910390f35b6101106100f236600461022c565b6001600160a01b03165f908152600491909101602052604090205490565b6040519081526020016100db565b818015610129575f5ffd5b5061008b61013836600461029e565b8281146101825760405162461bcd60e51b8152602060048201526014602482015273098cadccee8d0e640c8de40dcdee840dac2e8c6d60631b604482015260640160405180910390fd5b5f5b838110156101f25782828281811061019e5761019e610317565b90506020020135866004015f8787858181106101bc576101bc610317565b90506020020160208101906101d1919061032b565b6001600160a01b0316815260208101919091526040015f2055600101610184565b505050505050565b5f6020828403121561020a575f5ffd5b5035919050565b80356001600160a01b0381168114610227575f5ffd5b919050565b5f5f6040838503121561023d575f5ffd5b8235915061024d60208401610211565b90509250929050565b5f5f83601f840112610266575f5ffd5b50813567ffffffffffffffff81111561027d575f5ffd5b6020830191508360208260051b8501011115610297575f5ffd5b9250929050565b5f5f5f5f5f606086880312156102b2575f5ffd5b85359450602086013567ffffffffffffffff8111156102cf575f5ffd5b6102db88828901610256565b909550935050604086013567ffffffffffffffff8111156102fa575f5ffd5b61030688828901610256565b969995985093965092949392505050565b634e487b7160e01b5f52603260045260245ffd5b5f6020828403121561033b575f5ffd5b61034482610211565b939250505056fea26469706673582212200a2f75d9c1fdc82c6c73ad9859c159a691858fd85e661d5ba5d08f6134e037a164736f6c634300081e0033", } // LedgerBalanceLimitABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/channel/channel.go b/chain/channel-eth-go/channel/channel.go index 390de72..aa22dac 100644 --- a/chain/channel-eth-go/channel/channel.go +++ b/chain/channel-eth-go/channel/channel.go @@ -32,7 +32,7 @@ var ( // LedgerChannelMetaData contains all meta data concerning the LedgerChannel contract. var LedgerChannelMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x610eaa610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610610111575f3560e01c8063b80ddf7e116100a9578063c46dd9dd11610079578063c46dd9dd146102be578063c814d28e14610339578063c8ed149e1461034c578063d6b89e3a1461036e578063d7db65ce14610381575f5ffd5b8063b80ddf7e14610241578063bcdf4ebb14610256578063c2c3f21f14610269578063c2f8816b1461027c575f5ffd5b806377ffc623116100e457806377ffc623146101c35780638970f8a5146101d857806396a3c57f146101fb578063b32531271461021c575f5ffd5b806312bb8c81146101155780631fd4a9c214610143578063418ec1011461017e578063565aebdb1461019e575b5f5ffd5b61012d610123366004610c8e565b6002015460ff1690565b60405161013a9190610cb9565b60405180910390f35b610166610151366004610c8e565b6002015461010090046001600160a01b031690565b6040516001600160a01b03909116815260200161013a565b61019061018c366004610c8e565b5490565b60405190815260200161013a565b6101b66101ac366004610c8e565b6003015460ff1690565b60405161013a9190610cd3565b6101906101d1366004610c8e565b6014015490565b6101666101e6366004610c8e565b6003015461010090046001600160a01b031690565b61020e610209366004610c8e565b6103a2565b60405161013a929190610d3a565b61022f61022a366004610c8e565b6104cf565b60405161013a96959493929190610d55565b61019061024f366004610c8e565b6001015490565b61020e610264366004610c8e565b610692565b61020e610277366004610c8e565b6107c5565b61028f61028a366004610c8e565b6108f2565b60405161013a949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b61030f6102cc366004610c8e565b6040805160808101825260158301546001600160a01b03168082526016840154602083018190526017850154938301849052601890940154606090920182905293565b604080516001600160a01b039095168552602085019390935291830152606082015260800161013a565b61020e610347366004610c8e565b610942565b61035f61035a366004610c8e565b610a6b565b60405161013a93929190610db2565b61019061037c366004610c8e565b610b02565b61039461038f366004610c8e565b610b43565b60405161013a929190610de2565b6103aa610c70565b6103b2610c70565b604080518082019091525f9060048501600283835b8282101561045757604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a0810187526003840154815260048401548183015260058401549681019690965260068301546060878101919091526007909301549386019390935290830193909352908352920191016103c7565b5050505090506040518060400160405280825f6002811061047a5761047a610e20565b60209081029190910151516001600160a01b0390811683528482018051519091169282019290925260408051808201909152935160609081015181015185529151820151909101519083015294909350915050565b6104d7610c70565b6104df610c70565b6104e7610c70565b6104ef610c70565b6104f7610c70565b6104ff610c70565b604080518082019091525f9060048901600283835b828210156105a457604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101610514565b5050505090506040518060400160405280825f600281106105c7576105c7610e20565b60209081029190910151516001600160a01b03908116835284820180515190911692820192909252604080518082018252855183015181528351830151818401528151808301835286518301518152845183015181850152825180840184528751606090810151518252865181015151828701528451808601865289518201518701518152875182015187015181880152855180870190965298518101516080908101518652965101519095015193830193909352939c939b50909950909750919550909350915050565b61069a610c70565b6106a2610c70565b604080518082019091525f9060048501600283835b8282101561074757604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a0810187526003840154815260048401548183015260058401549681019690965260068301546060878101919091526007909301549386019390935290830193909352908352920191016106b7565b5050505090506040518060400160405280825f6002811061076a5761076a610e20565b60209081029190910151516001600160a01b0390811683528482015151169181019190915260408051808201909152835160600151608001518152908101836001602002015160600151608001518152509250925050915091565b6107cd610c70565b6107d5610c70565b604080518082019091525f9060048501600283835b8282101561087a57604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a0810187526003840154815260048401548183015260058401549681019690965260068301546060878101919091526007909301549386019390935290830193909352908352920191016107ea565b5050505090506040518060400160405280825f6002811061089d5761089d610e20565b60209081029190910151516001600160a01b0390811683528482018051519091169282019290925260408051808201909152935160609081015182015185529151909101518101519083015294909350915050565b60018101546002808301545f928392839283929160ff9091169081111561091b5761091b610ca5565b60028701546014909701549197909661010090046001600160a01b03169550909350915050565b61094a610c70565b610952610c70565b604080518082019091525f9060048501600283835b828210156109f757604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101610967565b5050505090506040518060400160405280825f60028110610a1a57610a1a610e20565b60209081029190910151516001600160a01b03908116835284820180515190911692820192909252604080518082019091529351606090810151518552915190910151519083015294909350915050565b610a73610c70565b610a7b610c70565b610a83610c70565b5f6040518060400160405280866004015f60028110610aa457610aa4610e20565b60080201546001600160a01b039081168252600c8801541660209182015260408051808201825260058901548152600d89015481840152815180830190925260068901548252600e9098015491810191909152909690945092505050565b600e8101546006820154600d83015460058401545f93849390929091610b289190610e48565b610b329190610e61565b610b3c9190610e61565b9392505050565b610b4b610c70565b610b53610c70565b604080518082019091525f9060048501600283835b82821015610bf857604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101610b68565b5050505090506040518060400160405280825f60028110610c1b57610c1b610e20565b60209081029190910151516001600160a01b0390811683528482018051519091169282019290925260408051808201825294516060908101518201518652925190920151909101519083015294909350915050565b60405180604001604052806002906020820280368337509192915050565b5f60208284031215610c9e575f5ffd5b5035919050565b634e487b7160e01b5f52602160045260245ffd5b6020810160038310610ccd57610ccd610ca5565b91905290565b6020810160058310610ccd57610ccd610ca5565b805f5b6002811015610d125781516001600160a01b0316845260209384019390910190600101610cea565b50505050565b805f5b6002811015610d12578151845260209384019390910190600101610d1b565b60808101610d488285610ce7565b610b3c6040830184610d18565b6101808101610d648289610ce7565b610d716040830188610d18565b610d7e6080830187610d18565b610d8b60c0830186610d18565b610d99610100830185610d18565b610da7610140830184610d18565b979650505050505050565b60c08101610dc08286610ce7565b610dcd6040830185610d18565b610dda6080830184610d18565b949350505050565b60808101610df08285610ce7565b60408201835f5b6002811015610e16578151835260209283019290910190600101610df7565b5050509392505050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610e5b57610e5b610e34565b92915050565b81810381811115610e5b57610e5b610e3456fea264697066735822122013329409b7862fd2e8c06e3292d0ca141f6e4e5f41ee2633feb4cb296ebabc9364736f6c634300081e0033", + Bin: "0x610eaa610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe7300000000000000000000000000000000000000003014608060405260043610610111575f3560e01c8063b80ddf7e116100a9578063c46dd9dd11610079578063c46dd9dd146102be578063c814d28e14610339578063c8ed149e1461034c578063d6b89e3a1461036e578063d7db65ce14610381575f5ffd5b8063b80ddf7e14610241578063bcdf4ebb14610256578063c2c3f21f14610269578063c2f8816b1461027c575f5ffd5b806377ffc623116100e457806377ffc623146101c35780638970f8a5146101d857806396a3c57f146101fb578063b32531271461021c575f5ffd5b806312bb8c81146101155780631fd4a9c214610143578063418ec1011461017e578063565aebdb1461019e575b5f5ffd5b61012d610123366004610c8e565b6002015460ff1690565b60405161013a9190610cb9565b60405180910390f35b610166610151366004610c8e565b6002015461010090046001600160a01b031690565b6040516001600160a01b03909116815260200161013a565b61019061018c366004610c8e565b5490565b60405190815260200161013a565b6101b66101ac366004610c8e565b6003015460ff1690565b60405161013a9190610cd3565b6101906101d1366004610c8e565b6014015490565b6101666101e6366004610c8e565b6003015461010090046001600160a01b031690565b61020e610209366004610c8e565b6103a2565b60405161013a929190610d3a565b61022f61022a366004610c8e565b6104cf565b60405161013a96959493929190610d55565b61019061024f366004610c8e565b6001015490565b61020e610264366004610c8e565b610692565b61020e610277366004610c8e565b6107c5565b61028f61028a366004610c8e565b6108f2565b60405161013a949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b61030f6102cc366004610c8e565b6040805160808101825260158301546001600160a01b03168082526016840154602083018190526017850154938301849052601890940154606090920182905293565b604080516001600160a01b039095168552602085019390935291830152606082015260800161013a565b61020e610347366004610c8e565b610942565b61035f61035a366004610c8e565b610a6b565b60405161013a93929190610db2565b61019061037c366004610c8e565b610b02565b61039461038f366004610c8e565b610b43565b60405161013a929190610de2565b6103aa610c70565b6103b2610c70565b604080518082019091525f9060048501600283835b8282101561045757604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a0810187526003840154815260048401548183015260058401549681019690965260068301546060878101919091526007909301549386019390935290830193909352908352920191016103c7565b5050505090506040518060400160405280825f6002811061047a5761047a610e20565b60209081029190910151516001600160a01b0390811683528482018051519091169282019290925260408051808201909152935160609081015181015185529151820151909101519083015294909350915050565b6104d7610c70565b6104df610c70565b6104e7610c70565b6104ef610c70565b6104f7610c70565b6104ff610c70565b604080518082019091525f9060048901600283835b828210156105a457604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101610514565b5050505090506040518060400160405280825f600281106105c7576105c7610e20565b60209081029190910151516001600160a01b03908116835284820180515190911692820192909252604080518082018252855183015181528351830151818401528151808301835286518301518152845183015181850152825180840184528751606090810151518252865181015151828701528451808601865289518201518701518152875182015187015181880152855180870190965298518101516080908101518652965101519095015193830193909352939c939b50909950909750919550909350915050565b61069a610c70565b6106a2610c70565b604080518082019091525f9060048501600283835b8282101561074757604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a0810187526003840154815260048401548183015260058401549681019690965260068301546060878101919091526007909301549386019390935290830193909352908352920191016106b7565b5050505090506040518060400160405280825f6002811061076a5761076a610e20565b60209081029190910151516001600160a01b0390811683528482015151169181019190915260408051808201909152835160600151608001518152908101836001602002015160600151608001518152509250925050915091565b6107cd610c70565b6107d5610c70565b604080518082019091525f9060048501600283835b8282101561087a57604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a0810187526003840154815260048401548183015260058401549681019690965260068301546060878101919091526007909301549386019390935290830193909352908352920191016107ea565b5050505090506040518060400160405280825f6002811061089d5761089d610e20565b60209081029190910151516001600160a01b0390811683528482018051519091169282019290925260408051808201909152935160609081015182015185529151909101518101519083015294909350915050565b60018101546002808301545f928392839283929160ff9091169081111561091b5761091b610ca5565b60028701546014909701549197909661010090046001600160a01b03169550909350915050565b61094a610c70565b610952610c70565b604080518082019091525f9060048501600283835b828210156109f757604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101610967565b5050505090506040518060400160405280825f60028110610a1a57610a1a610e20565b60209081029190910151516001600160a01b03908116835284820180515190911692820192909252604080518082019091529351606090810151518552915190910151519083015294909350915050565b610a73610c70565b610a7b610c70565b610a83610c70565b5f6040518060400160405280866004015f60028110610aa457610aa4610e20565b60080201546001600160a01b039081168252600c8801541660209182015260408051808201825260058901548152600d89015481840152815180830190925260068901548252600e9098015491810191909152909690945092505050565b600e8101546006820154600d83015460058401545f93849390929091610b289190610e48565b610b329190610e61565b610b3c9190610e61565b9392505050565b610b4b610c70565b610b53610c70565b604080518082019091525f9060048501600283835b82821015610bf857604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101610b68565b5050505090506040518060400160405280825f60028110610c1b57610c1b610e20565b60209081029190910151516001600160a01b0390811683528482018051519091169282019290925260408051808201825294516060908101518201518652925190920151909101519083015294909350915050565b60405180604001604052806002906020820280368337509192915050565b5f60208284031215610c9e575f5ffd5b5035919050565b634e487b7160e01b5f52602160045260245ffd5b6020810160038310610ccd57610ccd610ca5565b91905290565b6020810160058310610ccd57610ccd610ca5565b805f5b6002811015610d125781516001600160a01b0316845260209384019390910190600101610cea565b50505050565b805f5b6002811015610d12578151845260209384019390910190600101610d1b565b60808101610d488285610ce7565b610b3c6040830184610d18565b6101808101610d648289610ce7565b610d716040830188610d18565b610d7e6080830187610d18565b610d8b60c0830186610d18565b610d99610100830185610d18565b610da7610140830184610d18565b979650505050505050565b60c08101610dc08286610ce7565b610dcd6040830185610d18565b610dda6080830184610d18565b949350505050565b60808101610df08285610ce7565b60408201835f5b6002811015610e16578151835260209283019290910190600101610df7565b5050509392505050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610e5b57610e5b610e34565b92915050565b81810381811115610e5b57610e5b610e3456fea2646970667358221220d31c9164cf3596ae1e55858b4e833812c472525d7728d81d70b4261013dbf80e64736f6c634300081e0033", } // LedgerChannelABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/ethpool/ethpool.go b/chain/channel-eth-go/ethpool/ethpool.go index 50427e4..02a0e2d 100644 --- a/chain/channel-eth-go/ethpool/ethpool.go +++ b/chain/channel-eth-go/ethpool/ethpool.go @@ -32,7 +32,7 @@ var ( // EthPoolMetaData contains all meta data concerning the EthPool contract. var EthPoolMetaData = &bind.MetaData{ ABI: "[{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decreaseAllowance\",\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_subtractedValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"increaseAllowance\",\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_addedValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"_from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_to\",\"type\":\"address\",\"internalType\":\"addresspayable\"},{\"name\":\"_value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferToCelerWallet\",\"inputs\":[{\"name\":\"_from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_walletAddr\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"_value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Deposit\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false}]", - Bin: "0x6080604052348015600e575f5ffd5b50610a418061001c5f395ff3fe6080604052600436106100a5575f3560e01c806370a082311161006257806370a08231146101a75780637e1cd431146101e957806395d89b4114610208578063a457c2d714610238578063dd62ed3e14610257578063f340fa011461029b575f5ffd5b806306fdde03146100a9578063095ea7b3146100f357806323b872dd146101225780632e1a7d4d14610141578063313ce567146101625780633950935114610188575b5f5ffd5b3480156100b4575f5ffd5b506100dd60405180604001604052806009815260200168115d1a125b941bdbdb60ba1b81525081565b6040516100ea919061081f565b60405180910390f35b3480156100fe575f5ffd5b5061011261010d366004610868565b6102ae565b60405190151581526020016100ea565b34801561012d575f5ffd5b5061011261013c366004610892565b610330565b34801561014c575f5ffd5b5061016061015b3660046108d0565b6103b9565b005b34801561016d575f5ffd5b50610176601281565b60405160ff90911681526020016100ea565b348015610193575f5ffd5b506101126101a2366004610868565b6103c7565b3480156101b2575f5ffd5b506101db6101c13660046108e7565b6001600160a01b03165f9081526020819052604090205490565b6040519081526020016100ea565b3480156101f4575f5ffd5b50610112610203366004610909565b61045f565b348015610213575f5ffd5b506100dd60405180604001604052806005815260200164045746849560dc1b81525081565b348015610243575f5ffd5b50610112610252366004610868565b6105af565b348015610262575f5ffd5b506101db61027136600461094c565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6101606102a93660046108e7565b610604565b5f6001600160a01b0383166102de5760405162461bcd60e51b81526004016102d590610983565b60405180910390fd5b335f8181526001602090815260408083206001600160a01b03881680855290835292819020869055518581529192915f5160206109ec5f395f51905f5291015b60405180910390a35060015b92915050565b6001600160a01b0383165f90815260016020908152604080832033845290915281205461035e9083906109c5565b6001600160a01b0385165f81815260016020908152604080832033808552908352928190208590555193845290925f5160206109ec5f395f51905f52910160405180910390a36103af8484846106c6565b5060019392505050565b6103c43333836106c6565b50565b5f6001600160a01b0383166103ee5760405162461bcd60e51b81526004016102d590610983565b335f9081526001602090815260408083206001600160a01b038716845290915290205461041c9083906109d8565b335f8181526001602090815260408083206001600160a01b038916808552908352928190208590555193845290925f5160206109ec5f395f51905f52910161031e565b6001600160a01b0384165f90815260016020908152604080832033845290915281205461048d9083906109c5565b6001600160a01b0386165f81815260016020908152604080832033808552908352928190208590555193845290925f5160206109ec5f395f51905f52910160405180910390a36001600160a01b0385165f908152602081905260409020546104f69083906109c5565b6001600160a01b038681165f818152602081815260409182902094909455518581529187169290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3604051636b46cea760e11b81526004810184905284906001600160a01b0382169063d68d9d4e9085906024015f604051808303818588803b15801561058c575f5ffd5b505af115801561059e573d5f5f3e3d5ffd5b5060019a9950505050505050505050565b5f6001600160a01b0383166105d65760405162461bcd60e51b81526004016102d590610983565b335f9081526001602090815260408083206001600160a01b038716845290915290205461041c9083906109c5565b6001600160a01b0381166106525760405162461bcd60e51b8152602060048201526015602482015274052656365697665722061646472657373206973203605c1b60448201526064016102d5565b6001600160a01b0381165f908152602081905260409020546106759034906109d8565b6001600160a01b0382165f8181526020818152604091829020939093555134815290917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c910160405180910390a250565b6001600160a01b03821661070e5760405162461bcd60e51b815260206004820152600f60248201526e0546f2061646472657373206973203608c1b60448201526064016102d5565b6001600160a01b0383165f908152602081905260409020546107319082906109c5565b6001600160a01b038481165f818152602081815260409182902094909455518481529185169290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146107cd576040519150601f19603f3d011682016040523d82523d5f602084013e6107d2565b606091505b50509050806108195760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016102d5565b50505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146103c4575f5ffd5b5f5f60408385031215610879575f5ffd5b823561088481610854565b946020939093013593505050565b5f5f5f606084860312156108a4575f5ffd5b83356108af81610854565b925060208401356108bf81610854565b929592945050506040919091013590565b5f602082840312156108e0575f5ffd5b5035919050565b5f602082840312156108f7575f5ffd5b813561090281610854565b9392505050565b5f5f5f5f6080858703121561091c575f5ffd5b843561092781610854565b9350602085013561093781610854565b93969395505050506040820135916060013590565b5f5f6040838503121561095d575f5ffd5b823561096881610854565b9150602083013561097881610854565b809150509250929050565b60208082526014908201527305370656e646572206164647265737320697320360641b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561032a5761032a6109b1565b8082018082111561032a5761032a6109b156fe8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a2646970667358221220302e2596484806f0db3abb1d5cfff35659525a7cb8185f2c3858bb82d8ad9d4664736f6c634300081e0033", + Bin: "0x6080604052348015600e575f5ffd5b50610a418061001c5f395ff3fe6080604052600436106100a5575f3560e01c806370a082311161006257806370a08231146101a75780637e1cd431146101e957806395d89b4114610208578063a457c2d714610238578063dd62ed3e14610257578063f340fa011461029b575f5ffd5b806306fdde03146100a9578063095ea7b3146100f357806323b872dd146101225780632e1a7d4d14610141578063313ce567146101625780633950935114610188575b5f5ffd5b3480156100b4575f5ffd5b506100dd60405180604001604052806009815260200168115d1a125b941bdbdb60ba1b81525081565b6040516100ea919061081f565b60405180910390f35b3480156100fe575f5ffd5b5061011261010d366004610868565b6102ae565b60405190151581526020016100ea565b34801561012d575f5ffd5b5061011261013c366004610892565b610330565b34801561014c575f5ffd5b5061016061015b3660046108d0565b6103b9565b005b34801561016d575f5ffd5b50610176601281565b60405160ff90911681526020016100ea565b348015610193575f5ffd5b506101126101a2366004610868565b6103c7565b3480156101b2575f5ffd5b506101db6101c13660046108e7565b6001600160a01b03165f9081526020819052604090205490565b6040519081526020016100ea565b3480156101f4575f5ffd5b50610112610203366004610909565b61045f565b348015610213575f5ffd5b506100dd60405180604001604052806005815260200164045746849560dc1b81525081565b348015610243575f5ffd5b50610112610252366004610868565b6105af565b348015610262575f5ffd5b506101db61027136600461094c565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6101606102a93660046108e7565b610604565b5f6001600160a01b0383166102de5760405162461bcd60e51b81526004016102d590610983565b60405180910390fd5b335f8181526001602090815260408083206001600160a01b03881680855290835292819020869055518581529192915f5160206109ec5f395f51905f5291015b60405180910390a35060015b92915050565b6001600160a01b0383165f90815260016020908152604080832033845290915281205461035e9083906109c5565b6001600160a01b0385165f81815260016020908152604080832033808552908352928190208590555193845290925f5160206109ec5f395f51905f52910160405180910390a36103af8484846106c6565b5060019392505050565b6103c43333836106c6565b50565b5f6001600160a01b0383166103ee5760405162461bcd60e51b81526004016102d590610983565b335f9081526001602090815260408083206001600160a01b038716845290915290205461041c9083906109d8565b335f8181526001602090815260408083206001600160a01b038916808552908352928190208590555193845290925f5160206109ec5f395f51905f52910161031e565b6001600160a01b0384165f90815260016020908152604080832033845290915281205461048d9083906109c5565b6001600160a01b0386165f81815260016020908152604080832033808552908352928190208590555193845290925f5160206109ec5f395f51905f52910160405180910390a36001600160a01b0385165f908152602081905260409020546104f69083906109c5565b6001600160a01b038681165f818152602081815260409182902094909455518581529187169290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3604051636b46cea760e11b81526004810184905284906001600160a01b0382169063d68d9d4e9085906024015f604051808303818588803b15801561058c575f5ffd5b505af115801561059e573d5f5f3e3d5ffd5b5060019a9950505050505050505050565b5f6001600160a01b0383166105d65760405162461bcd60e51b81526004016102d590610983565b335f9081526001602090815260408083206001600160a01b038716845290915290205461041c9083906109c5565b6001600160a01b0381166106525760405162461bcd60e51b8152602060048201526015602482015274052656365697665722061646472657373206973203605c1b60448201526064016102d5565b6001600160a01b0381165f908152602081905260409020546106759034906109d8565b6001600160a01b0382165f8181526020818152604091829020939093555134815290917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c910160405180910390a250565b6001600160a01b03821661070e5760405162461bcd60e51b815260206004820152600f60248201526e0546f2061646472657373206973203608c1b60448201526064016102d5565b6001600160a01b0383165f908152602081905260409020546107319082906109c5565b6001600160a01b038481165f818152602081815260409182902094909455518481529185169290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146107cd576040519150601f19603f3d011682016040523d82523d5f602084013e6107d2565b606091505b50509050806108195760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016102d5565b50505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b03811681146103c4575f5ffd5b5f5f60408385031215610879575f5ffd5b823561088481610854565b946020939093013593505050565b5f5f5f606084860312156108a4575f5ffd5b83356108af81610854565b925060208401356108bf81610854565b929592945050506040919091013590565b5f602082840312156108e0575f5ffd5b5035919050565b5f602082840312156108f7575f5ffd5b813561090281610854565b9392505050565b5f5f5f5f6080858703121561091c575f5ffd5b843561092781610854565b9350602085013561093781610854565b93969395505050506040820135916060013590565b5f5f6040838503121561095d575f5ffd5b823561096881610854565b9150602083013561097881610854565b809150509250929050565b60208082526014908201527305370656e646572206164647265737320697320360641b604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561032a5761032a6109b1565b8082018082111561032a5761032a6109b156fe8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925a26469706673582212207fa6f109d1b62bcd3301aedc46cbb43299966b9cb156bfdfc3d2ce3b50e98b9e64736f6c634300081e0033", } // EthPoolABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/ledger/ledger.go b/chain/channel-eth-go/ledger/ledger.go index 0e9d335..fab49e0 100644 --- a/chain/channel-eth-go/ledger/ledger.go +++ b/chain/channel-eth-go/ledger/ledger.go @@ -32,7 +32,7 @@ var ( // CelerLedgerMetaData contains all meta data concerning the CelerLedger contract. var CelerLedgerMetaData = &bind.MetaData{ ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_ethPool\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_payRegistry\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_celerWallet\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"clearPays\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_peerFrom\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_payIdList\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"confirmSettle\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"confirmWithdraw\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"cooperativeSettle\",\"inputs\":[{\"name\":\"_settleRequest\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"cooperativeWithdraw\",\"inputs\":[{\"name\":\"_cooperativeWithdrawRequest\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_receiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_transferFromAmount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"depositInBatch\",\"inputs\":[{\"name\":\"_channelIds\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_receivers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"_transferFromAmounts\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"disableBalanceLimits\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"enableBalanceLimits\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getBalanceLimit\",\"inputs\":[{\"name\":\"_tokenAddr\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBalanceLimitsEnabled\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBalanceMap\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCelerWallet\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getChannelMigrationArgs\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getChannelStatus\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumLedgerStruct.ChannelStatus\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getChannelStatusNum\",\"inputs\":[{\"name\":\"_channelStatus\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCooperativeWithdrawSeqNum\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getDisputeTimeout\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getEthPool\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLastPayResolveDeadlineMap\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMigratedTo\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getNextPayIdListHashMap\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"bytes32[2]\",\"internalType\":\"bytes32[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPayRegistry\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPeersMigrationInfo\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPendingPayOutMap\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getSettleFinalizedTime\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStateSeqNumMap\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTokenContract\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTokenType\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"enumPbEntity.TokenType\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTotalBalance\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransferOutMap\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[2]\",\"internalType\":\"address[2]\"},{\"name\":\"\",\"type\":\"uint256[2]\",\"internalType\":\"uint256[2]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getWithdrawIntent\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"intendSettle\",\"inputs\":[{\"name\":\"_signedSimplexStateArray\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"intendWithdraw\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_recipientChannelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"migrateChannelFrom\",\"inputs\":[{\"name\":\"_fromLedgerAddr\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_migrationRequest\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"migrateChannelTo\",\"inputs\":[{\"name\":\"_migrationRequest\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"openChannel\",\"inputs\":[{\"name\":\"_openRequest\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setBalanceLimits\",\"inputs\":[{\"name\":\"_tokenAddrs\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"_limits\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"snapshotStates\",\"inputs\":[{\"name\":\"_signedSimplexStateArray\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"vetoWithdraw\",\"inputs\":[{\"name\":\"_channelId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"ClearOnePay\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"payId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"peerFrom\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfirmSettle\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"settleBalance\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfirmSettleFail\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfirmWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"withdrawnAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"recipientChannelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"deposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"withdrawals\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CooperativeSettle\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"settleBalance\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CooperativeWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"withdrawnAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"recipientChannelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"deposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"withdrawals\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"seqNum\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Deposit\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"peerAddrs\",\"type\":\"address[2]\",\"indexed\":false,\"internalType\":\"address[2]\"},{\"name\":\"deposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"withdrawals\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"IntendSettle\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"seqNums\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"IntendWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MigrateChannelFrom\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"oldLedgerAddr\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MigrateChannelTo\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"newLedgerAddr\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OpenChannel\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"tokenType\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"tokenAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"peerAddrs\",\"type\":\"address[2]\",\"indexed\":false,\"internalType\":\"address[2]\"},{\"name\":\"initialDeposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SnapshotStates\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"seqNums\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"VetoWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"OwnableInvalidOwner\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]}]", - Bin: "0x608060405234801561000f575f5ffd5b506040516123df3803806123df83398101604081905261002e91610116565b338061005357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61005c816100ac565b50600280546001600160a01b039485166001600160a01b0319918216179091556003805493851693821693909317909255600480549190931691161790556006805460ff19166001179055610156565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114610111575f5ffd5b919050565b5f5f5f60608486031215610128575f5ffd5b610131846100fb565b925061013f602085016100fb565b915061014d604085016100fb565b90509250925092565b61227c806101635f395ff3fe608060405260043610610254575f3560e01c806393b7b3ce1161013f578063d75f960e116100b3578063e5780db211610078578063e5780db21461075c578063e6322df71461077b578063ec7c637d1461079a578063f0c73d70146107b9578063f2fde38b146107d8578063fd0a1a61146107f7575f5ffd5b8063d75f960e146106e3578063d927bfc4146106f7578063d954863c14610716578063e063913c14610729578063e0a515b71461073d575f5ffd5b8063bd480cb711610104578063bd480cb7146105ff578063c38a325d1461062d578063c7ff86251461064c578063cc0b94b71461066b578063cd3a1be614610697578063d757abd2146106c4575f5ffd5b806393b7b3ce1461056e578063979a9b5e146105815780639f1fad83146105ad578063a099a39f146105cc578063a8580cab146105e0575f5ffd5b8063312ea2c6116101d657806376bff1171161019b57806376bff117146104865780637e9a7a3e146104cf57806383c8f8b8146104ee57806388f41465146105025780638942ecb2146105335780638da5cb5b14610552575f5ffd5b8063312ea2c6146104015780634102b9a814610415578063666a6d651461043457806369d5dd6714610453578063715018a614610472575f5ffd5b80632b559ecc1161021c5780632b559ecc1461031a5780632e2a5a021461033e5780632e3c517a146103755780632f0ac30414610394578063307d6f96146103e2575f5ffd5b80630165cef81461025857806309683c031461028e57806309b65d86146102af578063130d33fe146102dc578063255aab59146102fb575b5f5ffd5b348015610263575f5ffd5b5061027761027236600461193f565b610816565b6040516102859291906119a3565b60405180910390f35b348015610299575f5ffd5b506102ad6102a8366004611a03565b6108b1565b005b3480156102ba575f5ffd5b506102ce6102c936600461193f565b61091d565b604051908152602001610285565b3480156102e7575f5ffd5b506102ad6102f6366004611a03565b6109a4565b348015610306575f5ffd5b506102ad61031536600461193f565b6109e0565b348015610325575f5ffd5b5061032e610a4a565b6040519015158152602001610285565b348015610349575f5ffd5b5061035d61035836600461193f565b610ac3565b6040516001600160a01b039091168152602001610285565b348015610380575f5ffd5b506102ad61038f366004611a56565b610b43565b34801561039f575f5ffd5b506103b36103ae36600461193f565b610bb2565b604051610285949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b3480156103ed575f5ffd5b506102ce6103fc36600461193f565b610c48565b34801561040c575f5ffd5b5061035d610cca565b348015610420575f5ffd5b506102ad61042f366004611a03565b610d3f565b34801561043f575f5ffd5b5061027761044e36600461193f565b610d7b565b34801561045e575f5ffd5b506102ce61046d36600461193f565b610dd1565b34801561047d575f5ffd5b506102ad610e16565b348015610491575f5ffd5b506104a56104a036600461193f565b610e29565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610285565b3480156104da575f5ffd5b506102ad6104e936600461193f565b610eaf565b3480156104f9575f5ffd5b506102ad610eee565b34801561050d575f5ffd5b5061052161051c36600461193f565b610f58565b60405161028596959493929190611aa7565b34801561053e575f5ffd5b506102ad61054d366004611b04565b61101e565b34801561055d575f5ffd5b505f546001600160a01b031661035d565b6102ad61057c366004611a03565b61106b565b34801561058c575f5ffd5b506105a061059b36600461193f565b6110a7565b6040516102859190611b41565b3480156105b8575f5ffd5b506102776105c736600461193f565b611126565b3480156105d7575f5ffd5b5061035d61117c565b3480156105eb575f5ffd5b506102ad6105fa366004611b9c565b6111b6565b34801561060a575f5ffd5b5061061e61061936600461193f565b611230565b60405161028593929190611c08565b348015610638575f5ffd5b5061035d61064736600461193f565b6112d6565b348015610657575f5ffd5b506102ad61066636600461193f565b61131b565b348015610676575f5ffd5b5061068a61068536600461193f565b61135a565b6040516102859190611c38565b3480156106a2575f5ffd5b506106b66106b136600461193f565b6113d9565b604051610285929190611c4c565b3480156106cf575f5ffd5b506102ad6106de366004611a03565b611469565b3480156106ee575f5ffd5b5061035d6114a5565b348015610702575f5ffd5b5061027761071136600461193f565b6114df565b6102ad610724366004611c8a565b611535565b348015610734575f5ffd5b506102ad61158a565b348015610748575f5ffd5b506102ce610757366004611a03565b6115ca565b348015610767575f5ffd5b506102ad610776366004611cbf565b611608565b348015610786575f5ffd5b506102ce61079536600461193f565b611753565b3480156107a5575f5ffd5b506102ce6107b4366004611d5e565b611798565b3480156107c4575f5ffd5b506102ce6107d336600461193f565b6117e1565b3480156107e3575f5ffd5b506102ad6107f2366004611d5e565b611826565b348015610802575f5ffd5b506102ad610811366004611d79565b611863565b61081e611921565b610826611921565b5f8381526007602052604090819020905163bcdf4ebb60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063bcdf4ebb906024015b608060405180830381865af4158015610883573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a79190611e9e565b9250925050915091565b6040516379e9008760e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__906379e90087906108ed9060019086908690600401611ef9565b5f6040518083038186803b158015610903575f5ffd5b505af4158015610915573d5f5f3e3d5ffd5b505050505050565b5f81815260076020526040808220905163418ec10160e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063418ec101906024015b602060405180830381865af4158015610979573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190611f1b565b9392505050565b604051630bdc541160e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__90630bdc5411906108ed9060019086908690600401611ef9565b60405163eb4de33760e01b8152600160048201526024810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__9063eb4de337906044015b5f6040518083038186803b158015610a31575f5ffd5b505af4158015610a43573d5f5f3e3d5ffd5b5050505050565b604051633574ba3960e11b8152600160048201525f9073__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__90636ae9747290602401602060405180830381865af4158015610a9a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610abe9190611f32565b905090565b5f818152600760205260408082209051630fea54e160e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__90631fd4a9c2906024015b602060405180830381865af4158015610b1f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190611f51565b60405163415a19c560e11b815273__$2da4c1bc7831bce59d8f8d9cf5a8504e33$__906382b4338a90610b8190600190879087908790600401611f6c565b5f6040518083038186803b158015610b97575f5ffd5b505af4158015610ba9573d5f5f3e3d5ffd5b50505050505050565b5f81815260076020526040808220905163c2f8816b60e01b8152600481018290528291829182919073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c2f8816b90602401608060405180830381865af4158015610c14573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c389190611fa0565b9450945094509450509193509193565b6040516360297df360e01b815260016004820152602481018290525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__906360297df3906044015b602060405180830381865af4158015610ca0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cc49190611f1b565b92915050565b6040516344e58d5160e01b8152600160048201525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__906344e58d51906024015b602060405180830381865af4158015610d1b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610abe9190611f51565b6040516372cf9b4360e11b815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063e59f3686906108ed9060019086908690600401611ef9565b610d83611921565b610d8b611921565b5f8381526007602052604090819020905163640a694760e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c814d28e90602401610868565b5f818152600760205260408082209051636b5c4f1d60e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d6b89e3a9060240161095e565b610e1e6118a6565b610e275f6118d2565b565b5f81815260076020526040808220905163c46dd9dd60e01b8152600481018290528291829182919073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c46dd9dd90602401608060405180830381865af4158015610e8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c389190611fdd565b6040516383e0fef560e01b8152600160048201526024810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__906383e0fef590604401610a1b565b610ef66118a6565b604051636ad1dc2d60e01b81526001600482015273__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__90636ad1dc2d906024015b5f6040518083038186803b158015610f40575f5ffd5b505af4158015610f52573d5f5f3e3d5ffd5b50505050565b610f60611921565b610f68611921565b610f70611921565b610f78611921565b610f80611921565b610f88611921565b5f8781526007602052604090819020905163b325312760e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063b32531279060240161018060405180830381865af4158015610fe5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110099190612019565b949d939c50919a509850965090945092505050565b604051637a2654ed60e01b81526001600482015260248101849052604481018390526064810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__90637a2654ed90608401610b81565b60405163594db6e360e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063594db6e3906108ed9060019086908690600401611ef9565b5f8181526007602052604080822090516312bb8c8160e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__906312bb8c8190602401602060405180830381865af4158015611102573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190612092565b61112e611921565b611136611921565b5f838152600760205260409081902090516396a3c57f60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__906396a3c57f90602401610868565b60405163bd199ca560e01b8152600160048201525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__9063bd199ca590602401610d00565b6111be6118a6565b60405163c88c626560e01b815273__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__9063c88c6265906111fe9060019088908890889088906004016120b0565b5f6040518083038186803b158015611214575f5ffd5b505af4158015611226573d5f5f3e3d5ffd5b5050505050505050565b611238611921565b611240611921565b611248611921565b5f848152600760205260409081902090516364768a4f60e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c8ed149e9060240160c060405180830381865af41580156112a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112c89190612134565b935093509350509193909250565b5f818152600760205260408082209051638970f8a560e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__90638970f8a590602401610b04565b60405163bb3d0f2b60e01b8152600160048201526024810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__9063bb3d0f2b90604401610a1b565b5f81815260076020526040808220905163565aebdb60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063565aebdb90602401602060405180830381865af41580156113b5573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190612177565b6113e1611921565b6113e9611921565b5f83815260076020526040908190209051636bedb2e760e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d7db65ce90602401608060405180830381865af4158015611445573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a79190612195565b60405163742fb50760e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063742fb507906108ed9060019086908690600401611ef9565b60405163c98c925160e01b8152600160048201525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__9063c98c925190602401610d00565b6114e7611921565b6114ef611921565b5f8381526007602052604090819020905163c2c3f21f60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c2c3f21f90602401610868565b60405163bd9d315760e01b815260016004820152602481018490526001600160a01b03831660448201526064810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__9063bd9d315790608401610b81565b6115926118a6565b604051635930e0e160e01b81526001600482015273__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__90635930e0e190602401610f2a565b604051631e28763960e11b81525f9073__$2da4c1bc7831bce59d8f8d9cf5a8504e33$__90633c50ec729061095e9060019087908790600401611ef9565b848314801561161657508281145b61165e5760405162461bcd60e51b8152602060048201526014602482015273098cadccee8d0e640c8de40dcdee840dac2e8c6d60631b60448201526064015b60405180910390fd5b5f5b85811015610ba95773__$c617d6f30a3108b63ce4034547dfec5d71$__63bd9d3157600189898581811061169657611696612205565b905060200201358888868181106116af576116af612205565b90506020020160208101906116c49190611d5e565b8787878181106116d6576116d6612205565b905060200201356040518563ffffffff1660e01b815260040161171b949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b5f6040518083038186803b158015611731575f5ffd5b505af4158015611743573d5f5f3e3d5ffd5b5050600190920191506116609050565b5f818152600760205260408082209051635c06efbf60e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063b80ddf7e9060240161095e565b60405163bdca79a760e01b8152600160048201526001600160a01b03821660248201525f9073__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__9063bdca79a790604401610c85565b5f8181526007602052604080822090516377ffc62360e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__906377ffc6239060240161095e565b61182e6118a6565b6001600160a01b03811661185757604051631e4fbdf760e01b81525f6004820152602401611655565b611860816118d2565b50565b604051600162804bef60e01b0319815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063ff7fb411906111fe906001908890889088908890600401612219565b5f546001600160a01b03163314610e275760405163118cdaa760e01b8152336004820152602401611655565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405180604001604052806002906020820280368337509192915050565b5f6020828403121561194f575f5ffd5b5035919050565b805f5b6002811015610f525781516001600160a01b0316845260209384019390910190600101611959565b805f5b6002811015610f52578151845260209384019390910190600101611984565b608081016119b18285611956565b61099d6040830184611981565b5f5f83601f8401126119ce575f5ffd5b50813567ffffffffffffffff8111156119e5575f5ffd5b6020830191508360208285010111156119fc575f5ffd5b9250929050565b5f5f60208385031215611a14575f5ffd5b823567ffffffffffffffff811115611a2a575f5ffd5b611a36858286016119be565b90969095509350505050565b6001600160a01b0381168114611860575f5ffd5b5f5f5f60408486031215611a68575f5ffd5b8335611a7381611a42565b9250602084013567ffffffffffffffff811115611a8e575f5ffd5b611a9a868287016119be565b9497909650939450505050565b6101808101611ab68289611956565b611ac36040830188611981565b611ad06080830187611981565b611add60c0830186611981565b611aeb610100830185611981565b611af9610140830184611981565b979650505050505050565b5f5f5f60608486031215611b16575f5ffd5b505081359360208301359350604090920135919050565b634e487b7160e01b5f52602160045260245ffd5b6020810160038310611b5557611b55611b2d565b91905290565b5f5f83601f840112611b6b575f5ffd5b50813567ffffffffffffffff811115611b82575f5ffd5b6020830191508360208260051b85010111156119fc575f5ffd5b5f5f5f5f60408587031215611baf575f5ffd5b843567ffffffffffffffff811115611bc5575f5ffd5b611bd187828801611b5b565b909550935050602085013567ffffffffffffffff811115611bf0575f5ffd5b611bfc87828801611b5b565b95989497509550505050565b60c08101611c168286611956565b611c236040830185611981565b611c306080830184611981565b949350505050565b6020810160058310611b5557611b55611b2d565b60808101611c5a8285611956565b60408201835f5b6002811015611c80578151835260209283019290910190600101611c61565b5050509392505050565b5f5f5f60608486031215611c9c575f5ffd5b833592506020840135611cae81611a42565b929592945050506040919091013590565b5f5f5f5f5f5f60608789031215611cd4575f5ffd5b863567ffffffffffffffff811115611cea575f5ffd5b611cf689828a01611b5b565b909750955050602087013567ffffffffffffffff811115611d15575f5ffd5b611d2189828a01611b5b565b909550935050604087013567ffffffffffffffff811115611d40575f5ffd5b611d4c89828a01611b5b565b979a9699509497509295939492505050565b5f60208284031215611d6e575f5ffd5b813561099d81611a42565b5f5f5f5f60608587031215611d8c575f5ffd5b843593506020850135611d9e81611a42565b9250604085013567ffffffffffffffff811115611db9575f5ffd5b611bfc878288016119be565b604051601f8201601f1916810167ffffffffffffffff81118282101715611dfa57634e487b7160e01b5f52604160045260245ffd5b604052919050565b5f82601f830112611e11575f5ffd5b611e1b6040611dc5565b806040840185811115611e2c575f5ffd5b845b81811015611e4f578051611e4181611a42565b845260209384019301611e2e565b509095945050505050565b5f82601f830112611e69575f5ffd5b611e736040611dc5565b806040840185811115611e84575f5ffd5b845b81811015611e4f578051845260209384019301611e86565b5f5f60808385031215611eaf575f5ffd5b611eb98484611e02565b9150611ec88460408501611e5a565b90509250929050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b838152604060208201525f611f12604083018486611ed1565b95945050505050565b5f60208284031215611f2b575f5ffd5b5051919050565b5f60208284031215611f42575f5ffd5b8151801515811461099d575f5ffd5b5f60208284031215611f61575f5ffd5b815161099d81611a42565b8481526001600160a01b03841660208201526060604082018190525f90611f969083018486611ed1565b9695505050505050565b5f5f5f5f60808587031215611fb3575f5ffd5b8451602086015160408701519195509350611fcd81611a42565b6060959095015193969295505050565b5f5f5f5f60808587031215611ff0575f5ffd5b8451611ffb81611a42565b60208601516040870151606090970151919890975090945092505050565b5f5f5f5f5f5f610180878903121561202f575f5ffd5b6120398888611e02565b95506120488860408901611e5a565b94506120578860808901611e5a565b93506120668860c08901611e5a565b9250612076886101008901611e5a565b9150612086886101408901611e5a565b90509295509295509295565b5f602082840312156120a2575f5ffd5b81516003811061099d575f5ffd5b85815260606020820181905281018490525f8560808301825b878110156120f95782356120dc81611a42565b6001600160a01b03168252602092830192909101906001016120c9565b5083810360408501528481526001600160fb1b03851115612118575f5ffd5b8460051b91508186602083013701602001979650505050505050565b5f5f5f60c08486031215612146575f5ffd5b6121508585611e02565b925061215f8560408601611e5a565b915061216e8560808601611e5a565b90509250925092565b5f60208284031215612187575f5ffd5b81516005811061099d575f5ffd5b5f5f608083850312156121a6575f5ffd5b6121b08484611e02565b915083605f8401126121c0575f5ffd5b6121ca6040611dc5565b8060808501868111156121db575f5ffd5b604086015b818110156121f85780518452602093840193016121e0565b5093969095509350505050565b634e487b7160e01b5f52603260045260245ffd5b85815284602082015260018060a01b0384166040820152608060608201525f611af9608083018486611ed156fea264697066735822122083c78b816ba5de1b41667f70b89541ec9521cf806e00d0c1b5fa2c8f39d1269164736f6c634300081e0033", + Bin: "0x608060405234801561000f575f5ffd5b506040516123df3803806123df83398101604081905261002e91610116565b338061005357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61005c816100ac565b50600280546001600160a01b039485166001600160a01b0319918216179091556003805493851693821693909317909255600480549190931691161790556006805460ff19166001179055610156565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114610111575f5ffd5b919050565b5f5f5f60608486031215610128575f5ffd5b610131846100fb565b925061013f602085016100fb565b915061014d604085016100fb565b90509250925092565b61227c806101635f395ff3fe608060405260043610610254575f3560e01c806393b7b3ce1161013f578063d75f960e116100b3578063e5780db211610078578063e5780db21461075c578063e6322df71461077b578063ec7c637d1461079a578063f0c73d70146107b9578063f2fde38b146107d8578063fd0a1a61146107f7575f5ffd5b8063d75f960e146106e3578063d927bfc4146106f7578063d954863c14610716578063e063913c14610729578063e0a515b71461073d575f5ffd5b8063bd480cb711610104578063bd480cb7146105ff578063c38a325d1461062d578063c7ff86251461064c578063cc0b94b71461066b578063cd3a1be614610697578063d757abd2146106c4575f5ffd5b806393b7b3ce1461056e578063979a9b5e146105815780639f1fad83146105ad578063a099a39f146105cc578063a8580cab146105e0575f5ffd5b8063312ea2c6116101d657806376bff1171161019b57806376bff117146104865780637e9a7a3e146104cf57806383c8f8b8146104ee57806388f41465146105025780638942ecb2146105335780638da5cb5b14610552575f5ffd5b8063312ea2c6146104015780634102b9a814610415578063666a6d651461043457806369d5dd6714610453578063715018a614610472575f5ffd5b80632b559ecc1161021c5780632b559ecc1461031a5780632e2a5a021461033e5780632e3c517a146103755780632f0ac30414610394578063307d6f96146103e2575f5ffd5b80630165cef81461025857806309683c031461028e57806309b65d86146102af578063130d33fe146102dc578063255aab59146102fb575b5f5ffd5b348015610263575f5ffd5b5061027761027236600461193f565b610816565b6040516102859291906119a3565b60405180910390f35b348015610299575f5ffd5b506102ad6102a8366004611a03565b6108b1565b005b3480156102ba575f5ffd5b506102ce6102c936600461193f565b61091d565b604051908152602001610285565b3480156102e7575f5ffd5b506102ad6102f6366004611a03565b6109a4565b348015610306575f5ffd5b506102ad61031536600461193f565b6109e0565b348015610325575f5ffd5b5061032e610a4a565b6040519015158152602001610285565b348015610349575f5ffd5b5061035d61035836600461193f565b610ac3565b6040516001600160a01b039091168152602001610285565b348015610380575f5ffd5b506102ad61038f366004611a56565b610b43565b34801561039f575f5ffd5b506103b36103ae36600461193f565b610bb2565b604051610285949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b3480156103ed575f5ffd5b506102ce6103fc36600461193f565b610c48565b34801561040c575f5ffd5b5061035d610cca565b348015610420575f5ffd5b506102ad61042f366004611a03565b610d3f565b34801561043f575f5ffd5b5061027761044e36600461193f565b610d7b565b34801561045e575f5ffd5b506102ce61046d36600461193f565b610dd1565b34801561047d575f5ffd5b506102ad610e16565b348015610491575f5ffd5b506104a56104a036600461193f565b610e29565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610285565b3480156104da575f5ffd5b506102ad6104e936600461193f565b610eaf565b3480156104f9575f5ffd5b506102ad610eee565b34801561050d575f5ffd5b5061052161051c36600461193f565b610f58565b60405161028596959493929190611aa7565b34801561053e575f5ffd5b506102ad61054d366004611b04565b61101e565b34801561055d575f5ffd5b505f546001600160a01b031661035d565b6102ad61057c366004611a03565b61106b565b34801561058c575f5ffd5b506105a061059b36600461193f565b6110a7565b6040516102859190611b41565b3480156105b8575f5ffd5b506102776105c736600461193f565b611126565b3480156105d7575f5ffd5b5061035d61117c565b3480156105eb575f5ffd5b506102ad6105fa366004611b9c565b6111b6565b34801561060a575f5ffd5b5061061e61061936600461193f565b611230565b60405161028593929190611c08565b348015610638575f5ffd5b5061035d61064736600461193f565b6112d6565b348015610657575f5ffd5b506102ad61066636600461193f565b61131b565b348015610676575f5ffd5b5061068a61068536600461193f565b61135a565b6040516102859190611c38565b3480156106a2575f5ffd5b506106b66106b136600461193f565b6113d9565b604051610285929190611c4c565b3480156106cf575f5ffd5b506102ad6106de366004611a03565b611469565b3480156106ee575f5ffd5b5061035d6114a5565b348015610702575f5ffd5b5061027761071136600461193f565b6114df565b6102ad610724366004611c8a565b611535565b348015610734575f5ffd5b506102ad61158a565b348015610748575f5ffd5b506102ce610757366004611a03565b6115ca565b348015610767575f5ffd5b506102ad610776366004611cbf565b611608565b348015610786575f5ffd5b506102ce61079536600461193f565b611753565b3480156107a5575f5ffd5b506102ce6107b4366004611d5e565b611798565b3480156107c4575f5ffd5b506102ce6107d336600461193f565b6117e1565b3480156107e3575f5ffd5b506102ad6107f2366004611d5e565b611826565b348015610802575f5ffd5b506102ad610811366004611d79565b611863565b61081e611921565b610826611921565b5f8381526007602052604090819020905163bcdf4ebb60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063bcdf4ebb906024015b608060405180830381865af4158015610883573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a79190611e9e565b9250925050915091565b6040516379e9008760e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__906379e90087906108ed9060019086908690600401611ef9565b5f6040518083038186803b158015610903575f5ffd5b505af4158015610915573d5f5f3e3d5ffd5b505050505050565b5f81815260076020526040808220905163418ec10160e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063418ec101906024015b602060405180830381865af4158015610979573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190611f1b565b9392505050565b604051630bdc541160e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__90630bdc5411906108ed9060019086908690600401611ef9565b60405163eb4de33760e01b8152600160048201526024810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__9063eb4de337906044015b5f6040518083038186803b158015610a31575f5ffd5b505af4158015610a43573d5f5f3e3d5ffd5b5050505050565b604051633574ba3960e11b8152600160048201525f9073__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__90636ae9747290602401602060405180830381865af4158015610a9a573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610abe9190611f32565b905090565b5f818152600760205260408082209051630fea54e160e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__90631fd4a9c2906024015b602060405180830381865af4158015610b1f573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190611f51565b60405163415a19c560e11b815273__$2da4c1bc7831bce59d8f8d9cf5a8504e33$__906382b4338a90610b8190600190879087908790600401611f6c565b5f6040518083038186803b158015610b97575f5ffd5b505af4158015610ba9573d5f5f3e3d5ffd5b50505050505050565b5f81815260076020526040808220905163c2f8816b60e01b8152600481018290528291829182919073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c2f8816b90602401608060405180830381865af4158015610c14573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c389190611fa0565b9450945094509450509193509193565b6040516360297df360e01b815260016004820152602481018290525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__906360297df3906044015b602060405180830381865af4158015610ca0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cc49190611f1b565b92915050565b6040516344e58d5160e01b8152600160048201525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__906344e58d51906024015b602060405180830381865af4158015610d1b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610abe9190611f51565b6040516372cf9b4360e11b815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063e59f3686906108ed9060019086908690600401611ef9565b610d83611921565b610d8b611921565b5f8381526007602052604090819020905163640a694760e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c814d28e90602401610868565b5f818152600760205260408082209051636b5c4f1d60e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d6b89e3a9060240161095e565b610e1e6118a6565b610e275f6118d2565b565b5f81815260076020526040808220905163c46dd9dd60e01b8152600481018290528291829182919073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c46dd9dd90602401608060405180830381865af4158015610e8b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c389190611fdd565b6040516383e0fef560e01b8152600160048201526024810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__906383e0fef590604401610a1b565b610ef66118a6565b604051636ad1dc2d60e01b81526001600482015273__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__90636ad1dc2d906024015b5f6040518083038186803b158015610f40575f5ffd5b505af4158015610f52573d5f5f3e3d5ffd5b50505050565b610f60611921565b610f68611921565b610f70611921565b610f78611921565b610f80611921565b610f88611921565b5f8781526007602052604090819020905163b325312760e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063b32531279060240161018060405180830381865af4158015610fe5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110099190612019565b949d939c50919a509850965090945092505050565b604051637a2654ed60e01b81526001600482015260248101849052604481018390526064810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__90637a2654ed90608401610b81565b60405163594db6e360e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063594db6e3906108ed9060019086908690600401611ef9565b5f8181526007602052604080822090516312bb8c8160e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__906312bb8c8190602401602060405180830381865af4158015611102573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190612092565b61112e611921565b611136611921565b5f838152600760205260409081902090516396a3c57f60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__906396a3c57f90602401610868565b60405163bd199ca560e01b8152600160048201525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__9063bd199ca590602401610d00565b6111be6118a6565b60405163c88c626560e01b815273__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__9063c88c6265906111fe9060019088908890889088906004016120b0565b5f6040518083038186803b158015611214575f5ffd5b505af4158015611226573d5f5f3e3d5ffd5b5050505050505050565b611238611921565b611240611921565b611248611921565b5f848152600760205260409081902090516364768a4f60e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c8ed149e9060240160c060405180830381865af41580156112a4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112c89190612134565b935093509350509193909250565b5f818152600760205260408082209051638970f8a560e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__90638970f8a590602401610b04565b60405163bb3d0f2b60e01b8152600160048201526024810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__9063bb3d0f2b90604401610a1b565b5f81815260076020526040808220905163565aebdb60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063565aebdb90602401602060405180830381865af41580156113b5573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099d9190612177565b6113e1611921565b6113e9611921565b5f83815260076020526040908190209051636bedb2e760e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d7db65ce90602401608060405180830381865af4158015611445573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a79190612195565b60405163742fb50760e01b815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063742fb507906108ed9060019086908690600401611ef9565b60405163c98c925160e01b8152600160048201525f9073__$c617d6f30a3108b63ce4034547dfec5d71$__9063c98c925190602401610d00565b6114e7611921565b6114ef611921565b5f8381526007602052604090819020905163c2c3f21f60e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c2c3f21f90602401610868565b60405163bd9d315760e01b815260016004820152602481018490526001600160a01b03831660448201526064810182905273__$c617d6f30a3108b63ce4034547dfec5d71$__9063bd9d315790608401610b81565b6115926118a6565b604051635930e0e160e01b81526001600482015273__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__90635930e0e190602401610f2a565b604051631e28763960e11b81525f9073__$2da4c1bc7831bce59d8f8d9cf5a8504e33$__90633c50ec729061095e9060019087908790600401611ef9565b848314801561161657508281145b61165e5760405162461bcd60e51b8152602060048201526014602482015273098cadccee8d0e640c8de40dcdee840dac2e8c6d60631b60448201526064015b60405180910390fd5b5f5b85811015610ba95773__$c617d6f30a3108b63ce4034547dfec5d71$__63bd9d3157600189898581811061169657611696612205565b905060200201358888868181106116af576116af612205565b90506020020160208101906116c49190611d5e565b8787878181106116d6576116d6612205565b905060200201356040518563ffffffff1660e01b815260040161171b949392919093845260208401929092526001600160a01b03166040830152606082015260800190565b5f6040518083038186803b158015611731575f5ffd5b505af4158015611743573d5f5f3e3d5ffd5b5050600190920191506116609050565b5f818152600760205260408082209051635c06efbf60e11b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063b80ddf7e9060240161095e565b60405163bdca79a760e01b8152600160048201526001600160a01b03821660248201525f9073__$feb14f72d15bbe8de11f7ce8bf95c6faf6$__9063bdca79a790604401610c85565b5f8181526007602052604080822090516377ffc62360e01b81526004810182905273__$13d4168a6482a4756bee5acfadcccc5f1f$__906377ffc6239060240161095e565b61182e6118a6565b6001600160a01b03811661185757604051631e4fbdf760e01b81525f6004820152602401611655565b611860816118d2565b50565b604051600162804bef60e01b0319815273__$c617d6f30a3108b63ce4034547dfec5d71$__9063ff7fb411906111fe906001908890889088908890600401612219565b5f546001600160a01b03163314610e275760405163118cdaa760e01b8152336004820152602401611655565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60405180604001604052806002906020820280368337509192915050565b5f6020828403121561194f575f5ffd5b5035919050565b805f5b6002811015610f525781516001600160a01b0316845260209384019390910190600101611959565b805f5b6002811015610f52578151845260209384019390910190600101611984565b608081016119b18285611956565b61099d6040830184611981565b5f5f83601f8401126119ce575f5ffd5b50813567ffffffffffffffff8111156119e5575f5ffd5b6020830191508360208285010111156119fc575f5ffd5b9250929050565b5f5f60208385031215611a14575f5ffd5b823567ffffffffffffffff811115611a2a575f5ffd5b611a36858286016119be565b90969095509350505050565b6001600160a01b0381168114611860575f5ffd5b5f5f5f60408486031215611a68575f5ffd5b8335611a7381611a42565b9250602084013567ffffffffffffffff811115611a8e575f5ffd5b611a9a868287016119be565b9497909650939450505050565b6101808101611ab68289611956565b611ac36040830188611981565b611ad06080830187611981565b611add60c0830186611981565b611aeb610100830185611981565b611af9610140830184611981565b979650505050505050565b5f5f5f60608486031215611b16575f5ffd5b505081359360208301359350604090920135919050565b634e487b7160e01b5f52602160045260245ffd5b6020810160038310611b5557611b55611b2d565b91905290565b5f5f83601f840112611b6b575f5ffd5b50813567ffffffffffffffff811115611b82575f5ffd5b6020830191508360208260051b85010111156119fc575f5ffd5b5f5f5f5f60408587031215611baf575f5ffd5b843567ffffffffffffffff811115611bc5575f5ffd5b611bd187828801611b5b565b909550935050602085013567ffffffffffffffff811115611bf0575f5ffd5b611bfc87828801611b5b565b95989497509550505050565b60c08101611c168286611956565b611c236040830185611981565b611c306080830184611981565b949350505050565b6020810160058310611b5557611b55611b2d565b60808101611c5a8285611956565b60408201835f5b6002811015611c80578151835260209283019290910190600101611c61565b5050509392505050565b5f5f5f60608486031215611c9c575f5ffd5b833592506020840135611cae81611a42565b929592945050506040919091013590565b5f5f5f5f5f5f60608789031215611cd4575f5ffd5b863567ffffffffffffffff811115611cea575f5ffd5b611cf689828a01611b5b565b909750955050602087013567ffffffffffffffff811115611d15575f5ffd5b611d2189828a01611b5b565b909550935050604087013567ffffffffffffffff811115611d40575f5ffd5b611d4c89828a01611b5b565b979a9699509497509295939492505050565b5f60208284031215611d6e575f5ffd5b813561099d81611a42565b5f5f5f5f60608587031215611d8c575f5ffd5b843593506020850135611d9e81611a42565b9250604085013567ffffffffffffffff811115611db9575f5ffd5b611bfc878288016119be565b604051601f8201601f1916810167ffffffffffffffff81118282101715611dfa57634e487b7160e01b5f52604160045260245ffd5b604052919050565b5f82601f830112611e11575f5ffd5b611e1b6040611dc5565b806040840185811115611e2c575f5ffd5b845b81811015611e4f578051611e4181611a42565b845260209384019301611e2e565b509095945050505050565b5f82601f830112611e69575f5ffd5b611e736040611dc5565b806040840185811115611e84575f5ffd5b845b81811015611e4f578051845260209384019301611e86565b5f5f60808385031215611eaf575f5ffd5b611eb98484611e02565b9150611ec88460408501611e5a565b90509250929050565b81835281816020850137505f828201602090810191909152601f909101601f19169091010190565b838152604060208201525f611f12604083018486611ed1565b95945050505050565b5f60208284031215611f2b575f5ffd5b5051919050565b5f60208284031215611f42575f5ffd5b8151801515811461099d575f5ffd5b5f60208284031215611f61575f5ffd5b815161099d81611a42565b8481526001600160a01b03841660208201526060604082018190525f90611f969083018486611ed1565b9695505050505050565b5f5f5f5f60808587031215611fb3575f5ffd5b8451602086015160408701519195509350611fcd81611a42565b6060959095015193969295505050565b5f5f5f5f60808587031215611ff0575f5ffd5b8451611ffb81611a42565b60208601516040870151606090970151919890975090945092505050565b5f5f5f5f5f5f610180878903121561202f575f5ffd5b6120398888611e02565b95506120488860408901611e5a565b94506120578860808901611e5a565b93506120668860c08901611e5a565b9250612076886101008901611e5a565b9150612086886101408901611e5a565b90509295509295509295565b5f602082840312156120a2575f5ffd5b81516003811061099d575f5ffd5b85815260606020820181905281018490525f8560808301825b878110156120f95782356120dc81611a42565b6001600160a01b03168252602092830192909101906001016120c9565b5083810360408501528481526001600160fb1b03851115612118575f5ffd5b8460051b91508186602083013701602001979650505050505050565b5f5f5f60c08486031215612146575f5ffd5b6121508585611e02565b925061215f8560408601611e5a565b915061216e8560808601611e5a565b90509250925092565b5f60208284031215612187575f5ffd5b81516005811061099d575f5ffd5b5f5f608083850312156121a6575f5ffd5b6121b08484611e02565b915083605f8401126121c0575f5ffd5b6121ca6040611dc5565b8060808501868111156121db575f5ffd5b604086015b818110156121f85780518452602093840193016121e0565b5093969095509350505050565b634e487b7160e01b5f52603260045260245ffd5b85815284602082015260018060a01b0384166040820152608060608201525f611af9608083018486611ed156fea2646970667358221220589b21814beccea8c0a74e0c41f30ebea605d9c63ba11562f51ee8a9420728e164736f6c634300081e0033", } // CelerLedgerABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/ledgerstruct/ledgerstruct.go b/chain/channel-eth-go/ledgerstruct/ledgerstruct.go index 9e3abcd..2a5b3e8 100644 --- a/chain/channel-eth-go/ledgerstruct/ledgerstruct.go +++ b/chain/channel-eth-go/ledgerstruct/ledgerstruct.go @@ -32,7 +32,7 @@ var ( // LedgerStructMetaData contains all meta data concerning the LedgerStruct contract. var LedgerStructMetaData = &bind.MetaData{ ABI: "[]", - Bin: "0x60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea2646970667358221220370edc75e4e65a76c28e5c17020be6685a476c1b90fb353a1cbe6755618f478a64736f6c634300081d0033", + Bin: "0x60556032600b8282823980515f1a607314602657634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f5ffdfea264697066735822122086cbc80fd4128cbe67ab9642d0a35a1dd2e3c285ca27f36a1a0731e568e4cfb064736f6c634300081e0033", } // LedgerStructABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/migrate/migrate.go b/chain/channel-eth-go/migrate/migrate.go index 723fb29..cbc3490 100644 --- a/chain/channel-eth-go/migrate/migrate.go +++ b/chain/channel-eth-go/migrate/migrate.go @@ -32,7 +32,7 @@ var ( // LedgerMigrateMetaData contains all meta data concerning the LedgerMigrate contract. var LedgerMigrateMetaData = &bind.MetaData{ ABI: "[{\"type\":\"event\",\"name\":\"MigrateChannelFrom\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"oldLedgerAddr\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MigrateChannelTo\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"newLedgerAddr\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignature\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignatureLength\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignatureS\",\"inputs\":[{\"name\":\"s\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]}]", - Bin: "0x611534610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061003f575f3560e01c80633c50ec721461004357806382b4338a14610074575b5f5ffd5b81801561004e575f5ffd5b5061006261005d36600461119d565b610095565b60405190815260200160405180910390f35b81801561007f575f5ffd5b5061009361008e3660046111fc565b61038f565b005b5f5f6100d584848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506105a692505050565b90505f6100e4825f0151610741565b80515f818152600689016020526040908190209083015192935090916001600383015460ff16600481111561011b5761011b611254565b148061013f57506002600383015460ff16600481111561013d5761013d611254565b145b610147575f5ffd5b8451805160209182012090860151610162908490839061083a565b6101aa5760405162461bcd60e51b815260206004820152601460248201527310da1958dac818dbcb5cda59dcc819985a5b195960621b60448201526064015b60405180910390fd5b60208501516001600160a01b031630146102065760405162461bcd60e51b815260206004820152601f60248201527f46726f6d206c65646765722061646472657373206973206e6f7420746869730060448201526064016101a1565b6001600160a01b038216331461026a5760405162461bcd60e51b815260206004820152602360248201527f546f206c65646765722061646472657373206973206e6f74206d73672e73656e6044820152623232b960e91b60648201526084016101a1565b84606001514311156102be5760405162461bcd60e51b815260206004820152601960248201527f506173736564206d6967726174696f6e20646561646c696e650000000000000060448201526064016101a1565b6102ca8a8460046108ff565b600383018054610100600160a81b0319166101006001600160a01b0385169081029190911790915560405185907fdefb8a94bbfc44ef5297b035407a7dd1314f369e39c3301f5b90f8810fb9fe4f905f90a360038a015460405163283226a360e21b8152600481018690526001600160a01b0384811660248301529091169063a0c89a8c906044015f604051808303815f87803b158015610369575f5ffd5b505af115801561037b573d5f5f3e3d5ffd5b5095985050505050505050505b9392505050565b60405163e0a515b760e01b815283905f906001600160a01b0383169063e0a515b7906103c19087908790600401611268565b6020604051808303815f875af11580156103dd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104019190611296565b5f8181526006880160205260408120919250600382015460ff16600481111561042c5761042c611254565b146104835760405162461bcd60e51b815260206004820152602160248201527f496d6d69677261746564206368616e6e656c20616c72656164792065786973746044820152607360f81b60648201526084016101a1565b6003870154604051632a5a97e560e21b81526004810184905230916001600160a01b03169063a96a5f9490602401602060405180830381865afa1580156104cc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104f091906112ad565b6001600160a01b0316146105465760405162461bcd60e51b815260206004820152601c60248201527f4f70657261746f7273686970206e6f74207472616e736665727265640000000060448201526064016101a1565b610552878260016108ff565b61055d818484610a36565b610568818484610b18565b6040516001600160a01b0387169083907f141a72a1d915a7c4205104b6e564cc991aa827c5f2c672a5d6a1da8bef99d6eb905f90a350505050505050565b60408051808201909152606080825260208201525f6105d783604080518082019091525f8152602081019190915290565b90505f6105e5826002610c97565b9050806002815181106105fa576105fa6112c8565b602002602001015167ffffffffffffffff81111561061a5761061a6112dc565b60405190808252806020026020018201604052801561064d57816020015b60608152602001906001900390816106385790505b5083602001819052505f8160028151811061066a5761066a6112c8565b6020026020010181815250505f5f5b602084015151845110156107385761069084610d50565b9092509050816001036106ad576106a684610d88565b8552610679565b81600203610729576106be84610d88565b8560200151846002815181106106d6576106d66112c8565b6020026020010151815181106106ee576106ee6112c8565b60200260200101819052508260028151811061070c5761070c6112c8565b60200260200101805180919061072190611304565b905250610679565b6107338482610e40565b610679565b50505050919050565b604080516080810182525f80825260208083018290528284018290526060830182905283518085019094528184528301849052909190805b602083015151835110156108325761079083610d50565b9092509050816001036107b5576107ae6107a984610d88565b610eb5565b8452610779565b816002036107e1576107ce6107c984610d88565b610ecb565b6001600160a01b03166020850152610779565b81600303610808576107f56107c984610d88565b6001600160a01b03166040850152610779565b816004036108235761081983610edb565b6060850152610779565b61082d8382610e40565b610779565b505050919050565b5f815160021461084b57505f610388565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c849052603c812090805b60028110156108f2576108b185828151811061089a5761089a6112c8565b602002602001015184610f4a90919063ffffffff16565b91508660040181600281106108c8576108c86112c8565b60080201546001600160a01b038381169116146108ea575f9350505050610388565b60010161087c565b5060019695505050505050565b80600481111561091157610911611254565b600383015460ff16600481111561092a5761092a611254565b0361093457505050565b5f600383015460ff16600481111561094e5761094e611254565b146109b957600382015460019084905f9060ff16600481111561097357610973611254565b81526020019081526020015f205461098b919061131c565b600383015484905f9060ff1660048111156109a8576109a8611254565b815260208101919091526040015f20555b825f8260048111156109cd576109cd611254565b81526020019081526020015f205460016109e7919061132f565b835f8360048111156109fb576109fb611254565b815260208101919091526040015f205560038201805482919060ff19166001836004811115610a2c57610a2c611254565b0217905550505050565b604051630bc2b0c160e21b8152600481018290525f906001600160a01b03841690632f0ac30490602401608060405180830381865afa158015610a7b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9f9190611342565b6014880155600280880180546001600160a01b0390931661010002610100600160a81b031990931692909217909155600187019290925591508190811115610ae957610ae9611254565b60028086018054909160ff19909116906001908490811115610b0d57610b0d611254565b021790555050505050565b5f5f5f5f5f5f876001600160a01b03166388f41465886040518263ffffffff1660e01b8152600401610b4c91815260200190565b61018060405180830381865afa158015610b68573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b8c919061140b565b9550955095509550955095505f5f90505b6002811015610c8b575f8a6004018260028110610bbc57610bbc6112c8565b600802019050878260028110610bd457610bd46112c8565b602002015181546001600160a01b0319166001600160a01b03909116178155868260028110610c0557610c056112c8565b60200201516001820155858260028110610c2157610c216112c8565b60200201518160020181905550848260028110610c4057610c406112c8565b60200201516003820155838260028110610c5c57610c5c6112c8565b60200201516004820155828260028110610c7857610c786112c8565b6020020151600790910155600101610b9d565b50505050505050505050565b8151606090610ca783600161132f565b67ffffffffffffffff811115610cbf57610cbf6112dc565b604051908082528060200260200182016040528015610ce8578160200160208202803683370190505b5091505f5f5b60208601515186511015610d4757610d0586610d50565b80925081935050506001848381518110610d2157610d216112c8565b60200260200101818151610d35919061132f565b905250610d428682610e40565b610cee565b50509092525090565b5f5f5f610d5c84610edb565b9050610d696008826114c8565b9250806007166005811115610d8057610d80611254565b915050915091565b60605f610d9483610edb565b90505f81845f0151610da6919061132f565b9050836020015151811115610db9575f5ffd5b8167ffffffffffffffff811115610dd257610dd26112dc565b6040519080825280601f01601f191660200182016040528015610dfc576020820181803683370190505b5060208086015186519295509181860191908301015f5b85811015610e35578181015183820152610e2e60208261132f565b9050610e13565b505050935250919050565b5f816005811115610e5357610e53611254565b03610e6657610e6182610edb565b505050565b6002816005811115610e7a57610e7a611254565b0361003f575f610e8983610edb565b905080835f01818151610e9c919061132f565b90525060208301515183511115610e61575f5ffd5b5050565b5f8151602014610ec3575f5ffd5b506020015190565b5f610ed582610f72565b92915050565b60208082015182518101909101515f9182805b600a81101561003f5783811a9150610f078160076114e7565b82607f16901b85179450816080165f03610f4257610f2681600161132f565b86518790610f3590839061132f565b9052509395945050505050565b600101610eee565b5f5f5f5f610f588686610f8f565b925092509250610f688282610fd8565b5090949350505050565b5f8151601414610f80575f5ffd5b5060200151600160601b900490565b5f5f5f8351604103610fc6576020840151604085015160608601515f1a610fb888828585611090565b955095509550505050610fd1565b505081515f91506002905b9250925092565b5f826003811115610feb57610feb611254565b03610ff4575050565b600182600381111561100857611008611254565b036110265760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561103a5761103a611254565b0361105b5760405163fce698f760e01b8152600481018290526024016101a1565b600382600381111561106f5761106f611254565b03610eb1576040516335e2f38360e21b8152600481018290526024016101a1565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156110c957505f9150600390508261114e565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801561111a573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b03811661114557505f92506001915082905061114e565b92505f91508190505b9450945094915050565b5f5f83601f840112611168575f5ffd5b50813567ffffffffffffffff81111561117f575f5ffd5b602083019150836020828501011115611196575f5ffd5b9250929050565b5f5f5f604084860312156111af575f5ffd5b83359250602084013567ffffffffffffffff8111156111cc575f5ffd5b6111d886828701611158565b9497909650939450505050565b6001600160a01b03811681146111f9575f5ffd5b50565b5f5f5f5f6060858703121561120f575f5ffd5b843593506020850135611221816111e5565b9250604085013567ffffffffffffffff81111561123c575f5ffd5b61124887828801611158565b95989497509550505050565b634e487b7160e01b5f52602160045260245ffd5b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b5f602082840312156112a6575f5ffd5b5051919050565b5f602082840312156112bd575f5ffd5b8151610388816111e5565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f60018201611315576113156112f0565b5060010190565b81810381811115610ed557610ed56112f0565b80820180821115610ed557610ed56112f0565b5f5f5f5f60808587031215611355575f5ffd5b845160208601516040870151919550935061136f816111e5565b6060959095015193969295505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156113b457634e487b7160e01b5f52604160045260245ffd5b604052919050565b5f82601f8301126113cb575f5ffd5b6113d5604061137f565b8060408401858111156113e6575f5ffd5b845b818110156114005780518452602093840193016113e8565b509095945050505050565b5f5f5f5f5f5f6101808789031215611421575f5ffd5b87601f88011261142f575f5ffd5b611439604061137f565b80604089018a81111561144a575f5ffd5b895b8181101561146d57805161145f816111e5565b84526020938401930161144c565b5081985061147b8b826113bc565b975050505061148d88608089016113bc565b935061149c8860c089016113bc565b92506114ac8861010089016113bc565b91506114bc8861014089016113bc565b90509295509295509295565b5f826114e257634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610ed557610ed56112f056fea264697066735822122055c5a99b9c09be8d612c3c14bcfb11739aee73687df88def1ac05145ce75e45164736f6c634300081e0033", + Bin: "0x611534610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061003f575f3560e01c80633c50ec721461004357806382b4338a14610074575b5f5ffd5b81801561004e575f5ffd5b5061006261005d36600461119d565b610095565b60405190815260200160405180910390f35b81801561007f575f5ffd5b5061009361008e3660046111fc565b61038f565b005b5f5f6100d584848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506105a692505050565b90505f6100e4825f0151610741565b80515f818152600689016020526040908190209083015192935090916001600383015460ff16600481111561011b5761011b611254565b148061013f57506002600383015460ff16600481111561013d5761013d611254565b145b610147575f5ffd5b8451805160209182012090860151610162908490839061083a565b6101aa5760405162461bcd60e51b815260206004820152601460248201527310da1958dac818dbcb5cda59dcc819985a5b195960621b60448201526064015b60405180910390fd5b60208501516001600160a01b031630146102065760405162461bcd60e51b815260206004820152601f60248201527f46726f6d206c65646765722061646472657373206973206e6f7420746869730060448201526064016101a1565b6001600160a01b038216331461026a5760405162461bcd60e51b815260206004820152602360248201527f546f206c65646765722061646472657373206973206e6f74206d73672e73656e6044820152623232b960e91b60648201526084016101a1565b84606001514211156102be5760405162461bcd60e51b815260206004820152601960248201527f506173736564206d6967726174696f6e20646561646c696e650000000000000060448201526064016101a1565b6102ca8a8460046108ff565b600383018054610100600160a81b0319166101006001600160a01b0385169081029190911790915560405185907fdefb8a94bbfc44ef5297b035407a7dd1314f369e39c3301f5b90f8810fb9fe4f905f90a360038a015460405163283226a360e21b8152600481018690526001600160a01b0384811660248301529091169063a0c89a8c906044015f604051808303815f87803b158015610369575f5ffd5b505af115801561037b573d5f5f3e3d5ffd5b5095985050505050505050505b9392505050565b60405163e0a515b760e01b815283905f906001600160a01b0383169063e0a515b7906103c19087908790600401611268565b6020604051808303815f875af11580156103dd573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104019190611296565b5f8181526006880160205260408120919250600382015460ff16600481111561042c5761042c611254565b146104835760405162461bcd60e51b815260206004820152602160248201527f496d6d69677261746564206368616e6e656c20616c72656164792065786973746044820152607360f81b60648201526084016101a1565b6003870154604051632a5a97e560e21b81526004810184905230916001600160a01b03169063a96a5f9490602401602060405180830381865afa1580156104cc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104f091906112ad565b6001600160a01b0316146105465760405162461bcd60e51b815260206004820152601c60248201527f4f70657261746f7273686970206e6f74207472616e736665727265640000000060448201526064016101a1565b610552878260016108ff565b61055d818484610a36565b610568818484610b18565b6040516001600160a01b0387169083907f141a72a1d915a7c4205104b6e564cc991aa827c5f2c672a5d6a1da8bef99d6eb905f90a350505050505050565b60408051808201909152606080825260208201525f6105d783604080518082019091525f8152602081019190915290565b90505f6105e5826002610c97565b9050806002815181106105fa576105fa6112c8565b602002602001015167ffffffffffffffff81111561061a5761061a6112dc565b60405190808252806020026020018201604052801561064d57816020015b60608152602001906001900390816106385790505b5083602001819052505f8160028151811061066a5761066a6112c8565b6020026020010181815250505f5f5b602084015151845110156107385761069084610d50565b9092509050816001036106ad576106a684610d88565b8552610679565b81600203610729576106be84610d88565b8560200151846002815181106106d6576106d66112c8565b6020026020010151815181106106ee576106ee6112c8565b60200260200101819052508260028151811061070c5761070c6112c8565b60200260200101805180919061072190611304565b905250610679565b6107338482610e40565b610679565b50505050919050565b604080516080810182525f80825260208083018290528284018290526060830182905283518085019094528184528301849052909190805b602083015151835110156108325761079083610d50565b9092509050816001036107b5576107ae6107a984610d88565b610eb5565b8452610779565b816002036107e1576107ce6107c984610d88565b610ecb565b6001600160a01b03166020850152610779565b81600303610808576107f56107c984610d88565b6001600160a01b03166040850152610779565b816004036108235761081983610edb565b6060850152610779565b61082d8382610e40565b610779565b505050919050565b5f815160021461084b57505f610388565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c849052603c812090805b60028110156108f2576108b185828151811061089a5761089a6112c8565b602002602001015184610f4a90919063ffffffff16565b91508660040181600281106108c8576108c86112c8565b60080201546001600160a01b038381169116146108ea575f9350505050610388565b60010161087c565b5060019695505050505050565b80600481111561091157610911611254565b600383015460ff16600481111561092a5761092a611254565b0361093457505050565b5f600383015460ff16600481111561094e5761094e611254565b146109b957600382015460019084905f9060ff16600481111561097357610973611254565b81526020019081526020015f205461098b919061131c565b600383015484905f9060ff1660048111156109a8576109a8611254565b815260208101919091526040015f20555b825f8260048111156109cd576109cd611254565b81526020019081526020015f205460016109e7919061132f565b835f8360048111156109fb576109fb611254565b815260208101919091526040015f205560038201805482919060ff19166001836004811115610a2c57610a2c611254565b0217905550505050565b604051630bc2b0c160e21b8152600481018290525f906001600160a01b03841690632f0ac30490602401608060405180830381865afa158015610a7b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a9f9190611342565b6014880155600280880180546001600160a01b0390931661010002610100600160a81b031990931692909217909155600187019290925591508190811115610ae957610ae9611254565b60028086018054909160ff19909116906001908490811115610b0d57610b0d611254565b021790555050505050565b5f5f5f5f5f5f876001600160a01b03166388f41465886040518263ffffffff1660e01b8152600401610b4c91815260200190565b61018060405180830381865afa158015610b68573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b8c919061140b565b9550955095509550955095505f5f90505b6002811015610c8b575f8a6004018260028110610bbc57610bbc6112c8565b600802019050878260028110610bd457610bd46112c8565b602002015181546001600160a01b0319166001600160a01b03909116178155868260028110610c0557610c056112c8565b60200201516001820155858260028110610c2157610c216112c8565b60200201518160020181905550848260028110610c4057610c406112c8565b60200201516003820155838260028110610c5c57610c5c6112c8565b60200201516004820155828260028110610c7857610c786112c8565b6020020151600790910155600101610b9d565b50505050505050505050565b8151606090610ca783600161132f565b67ffffffffffffffff811115610cbf57610cbf6112dc565b604051908082528060200260200182016040528015610ce8578160200160208202803683370190505b5091505f5f5b60208601515186511015610d4757610d0586610d50565b80925081935050506001848381518110610d2157610d216112c8565b60200260200101818151610d35919061132f565b905250610d428682610e40565b610cee565b50509092525090565b5f5f5f610d5c84610edb565b9050610d696008826114c8565b9250806007166005811115610d8057610d80611254565b915050915091565b60605f610d9483610edb565b90505f81845f0151610da6919061132f565b9050836020015151811115610db9575f5ffd5b8167ffffffffffffffff811115610dd257610dd26112dc565b6040519080825280601f01601f191660200182016040528015610dfc576020820181803683370190505b5060208086015186519295509181860191908301015f5b85811015610e35578181015183820152610e2e60208261132f565b9050610e13565b505050935250919050565b5f816005811115610e5357610e53611254565b03610e6657610e6182610edb565b505050565b6002816005811115610e7a57610e7a611254565b0361003f575f610e8983610edb565b905080835f01818151610e9c919061132f565b90525060208301515183511115610e61575f5ffd5b5050565b5f8151602014610ec3575f5ffd5b506020015190565b5f610ed582610f72565b92915050565b60208082015182518101909101515f9182805b600a81101561003f5783811a9150610f078160076114e7565b82607f16901b85179450816080165f03610f4257610f2681600161132f565b86518790610f3590839061132f565b9052509395945050505050565b600101610eee565b5f5f5f5f610f588686610f8f565b925092509250610f688282610fd8565b5090949350505050565b5f8151601414610f80575f5ffd5b5060200151600160601b900490565b5f5f5f8351604103610fc6576020840151604085015160608601515f1a610fb888828585611090565b955095509550505050610fd1565b505081515f91506002905b9250925092565b5f826003811115610feb57610feb611254565b03610ff4575050565b600182600381111561100857611008611254565b036110265760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561103a5761103a611254565b0361105b5760405163fce698f760e01b8152600481018290526024016101a1565b600382600381111561106f5761106f611254565b03610eb1576040516335e2f38360e21b8152600481018290526024016101a1565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156110c957505f9150600390508261114e565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801561111a573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b03811661114557505f92506001915082905061114e565b92505f91508190505b9450945094915050565b5f5f83601f840112611168575f5ffd5b50813567ffffffffffffffff81111561117f575f5ffd5b602083019150836020828501011115611196575f5ffd5b9250929050565b5f5f5f604084860312156111af575f5ffd5b83359250602084013567ffffffffffffffff8111156111cc575f5ffd5b6111d886828701611158565b9497909650939450505050565b6001600160a01b03811681146111f9575f5ffd5b50565b5f5f5f5f6060858703121561120f575f5ffd5b843593506020850135611221816111e5565b9250604085013567ffffffffffffffff81111561123c575f5ffd5b61124887828801611158565b95989497509550505050565b634e487b7160e01b5f52602160045260245ffd5b60208152816020820152818360408301375f818301604090810191909152601f909201601f19160101919050565b5f602082840312156112a6575f5ffd5b5051919050565b5f602082840312156112bd575f5ffd5b8151610388816111e5565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f60018201611315576113156112f0565b5060010190565b81810381811115610ed557610ed56112f0565b80820180821115610ed557610ed56112f0565b5f5f5f5f60808587031215611355575f5ffd5b845160208601516040870151919550935061136f816111e5565b6060959095015193969295505050565b604051601f8201601f1916810167ffffffffffffffff811182821017156113b457634e487b7160e01b5f52604160045260245ffd5b604052919050565b5f82601f8301126113cb575f5ffd5b6113d5604061137f565b8060408401858111156113e6575f5ffd5b845b818110156114005780518452602093840193016113e8565b509095945050505050565b5f5f5f5f5f5f6101808789031215611421575f5ffd5b87601f88011261142f575f5ffd5b611439604061137f565b80604089018a81111561144a575f5ffd5b895b8181101561146d57805161145f816111e5565b84526020938401930161144c565b5081985061147b8b826113bc565b975050505061148d88608089016113bc565b935061149c8860c089016113bc565b92506114ac8861010089016113bc565b91506114bc8861014089016113bc565b90509295509295509295565b5f826114e257634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610ed557610ed56112f056fea2646970667358221220c1c39f09a79ffbaba558bdaebfb0e1c26c1ef42552397fa776a6dd23857a69fb64736f6c634300081e0033", } // LedgerMigrateABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/operation/operation.go b/chain/channel-eth-go/operation/operation.go index c182261..f47f7ab 100644 --- a/chain/channel-eth-go/operation/operation.go +++ b/chain/channel-eth-go/operation/operation.go @@ -32,7 +32,7 @@ var ( // LedgerOperationMetaData contains all meta data concerning the LedgerOperation contract. var LedgerOperationMetaData = &bind.MetaData{ ABI: "[{\"type\":\"event\",\"name\":\"ClearOnePay\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"payId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"peerFrom\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfirmSettle\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"settleBalance\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfirmSettleFail\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfirmWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"withdrawnAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"recipientChannelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"deposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"withdrawals\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CooperativeSettle\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"settleBalance\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CooperativeWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"withdrawnAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"recipientChannelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"deposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"withdrawals\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"seqNum\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Deposit\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"peerAddrs\",\"type\":\"address[2]\",\"indexed\":false,\"internalType\":\"address[2]\"},{\"name\":\"deposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"},{\"name\":\"withdrawals\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"IntendSettle\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"seqNums\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"IntendWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OpenChannel\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"tokenType\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"tokenAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"peerAddrs\",\"type\":\"address[2]\",\"indexed\":false,\"internalType\":\"address[2]\"},{\"name\":\"initialDeposits\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SnapshotStates\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"seqNums\",\"type\":\"uint256[2]\",\"indexed\":false,\"internalType\":\"uint256[2]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"VetoWithdraw\",\"inputs\":[{\"name\":\"channelId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignature\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignatureLength\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignatureS\",\"inputs\":[{\"name\":\"s\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"SafeERC20FailedOperation\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}]}]", - Bin: "0x615496610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100fb575f3560e01c806383e0fef51161009e578063c98c92511161006e578063c98c925114610273578063e59f368614610291578063eb4de337146102b0578063ff7fb411146102cf575f5ffd5b806383e0fef5146101f8578063bb3d0f2b14610217578063bd199ca514610236578063bd9d315714610254575f5ffd5b806360297df3116100d957806360297df31461017a578063742fb5071461019b57806379e90087146101ba5780637a2654ed146101d9575f5ffd5b80630bdc5411146100ff57806344e58d5114610120578063594db6e31461015b575b5f5ffd5b81801561010a575f5ffd5b5061011e610119366004614de5565b6102ee565b005b61013e61012e366004614e2c565b600201546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b818015610166575f5ffd5b5061011e610175366004614de5565b610841565b61018d610188366004614e43565b610fb4565b604051908152602001610152565b8180156101a6575f5ffd5b5061011e6101b5366004614de5565b610fc9565b8180156101c5575f5ffd5b5061011e6101d4366004614de5565b61121e565b8180156101e4575f5ffd5b5061011e6101f3366004614e63565b61163d565b818015610203575f5ffd5b5061011e610212366004614e43565b611760565b818015610222575f5ffd5b5061011e610231366004614e43565b611a9a565b61013e610244366004614e2c565b600301546001600160a01b031690565b81801561025f575f5ffd5b5061011e61026e366004614ea9565b611c89565b61013e610281366004614e2c565b600101546001600160a01b031690565b81801561029c575f5ffd5b5061011e6102ab366004614de5565b611ebe565b8180156102bb575f5ffd5b5061011e6102ca366004614e43565b61218c565b8180156102da575f5ffd5b5061011e6102e9366004614ee5565b6122d1565b5f61032d83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506123fe92505050565b805180519192505f9061035890828461034857610348614f49565b60200260200101515f0151612586565b90505f5b828110156108385781515f818152600689016020526040902061037f81336126c3565b15610419576001600382015460ff16600481111561039f5761039f614f5d565b14806103c357506002600382015460ff1660048111156103c1576103c1614f5d565b145b6104145760405162461bcd60e51b815260206004820152601960248201527f50656572206368616e6e656c20737461747573206572726f720000000000000060448201526064015b60405180910390fd5b610481565b6002600382015460ff16600481111561043457610434614f5d565b146104815760405162461bcd60e51b815260206004820152601c60248201527f4e6f6e70656572206368616e6e656c20737461747573206572726f7200000000604482015260640161040b565b8054158061048f5750805443105b6104db5760405162461bcd60e51b815260206004820152601c60248201527f536574746c652068617320616c72656164792066696e616c697a656400000000604482015260640161040b565b5f865f015184815181106104f1576104f1614f49565b60200260200101515f01518051906020012090505f875f0151858151811061051b5761051b614f49565b60200260200101516020015190505f86604001511115610695576105408383836126f9565b61055c5760405162461bcd60e51b815260040161040b90614f71565b5f6105748760200151856127be90919063ffffffff16565b90505f84600401826002811061058c5761058c614f49565b600802016003019050600160048111156105a8576105a8614f5d565b600386015460ff1660048111156105c1576105c1614f5d565b036105f0578054604089015110156105eb5760405162461bcd60e51b815260040161040b90614f9f565b61063c565b6002600386015460ff16600481111561060b5761060b614f5d565b036106345780546040890151116105eb5760405162461bcd60e51b815260040161040b90614f9f565b61063c614fc5565b6040880151815560608801516020908101518101516001830155608089015101516002820181905560a089015160038301551561067e5760c088015160048201555b61068e8d87848b60800151612837565b505061076b565b85604001515f03610763578254156106e55760405162461bcd60e51b8152602060048201526013602482015272696e74656e64536574746c65206265666f726560681b604482015260640161040b565b8051600114801561071f575061071f82825f8151811061070757610707614f49565b602002602001015185612a869092919063ffffffff16565b61075e5760405162461bcd60e51b815260206004820152601060248201526f10da1958dac81cda59c819985a5b195960821b604482015260640161040b565b61076b565b61076b614fc5565b610776600188614fed565b850361078b576107868b85612ad5565b610828565b610796600188614fed565b8510156108205787516107be906107ae876001615000565b8151811061034857610348614f49565b805190965084111561080d5760405162461bcd60e51b81526020600482015260186024820152774e6f6e2d617363656e64696e67206368616e6e656c49647360401b604482015260640161040b565b8551841015610786576107868b85612ad5565b610828614fc5565b50506001909201915061035c9050565b50505050505050565b5f61088083838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250612b4692505050565b90505f61088f825f0151612cd7565b805160200151519091506002146108d75760405162461bcd60e51b815260206004820152600c60248201526b0aee4dedcce40d8cadccee8d60a31b604482015260640161040b565b80602001514311156109225760405162461bcd60e51b815260206004820152601460248201527313dc195b88191958591b1a5b99481c185cdcd95960621b604482015260640161040b565b8051516040805180820190915282516020015180515f92918291849061094a5761094a614f49565b6020026020010151602001518152602001845f01516020015160018151811061097557610975614f49565b60200260200101516020015181525090505f6040518060400160405280855f0151602001515f815181106109ab576109ab614f49565b60200260200101515f01516001600160a01b03166001600160a01b03168152602001855f0151602001516001815181106109e7576109e7614f49565b602090810291909101810151516001600160a01b0390811690925282015182519293508116911610610a5b5760405162461bcd60e51b815260206004820152601c60248201527f5065657220616464727320617265206e6f7420617363656e64696e6700000000604482015260640161040b565b6003880154855180516020909101206001600160a01b03909116905f80610a848c858786612dd1565b9150915087604001518160010181905550610aa18c826001612f77565b610aaa876130ae565b805160028084018054909291839160ff1916906001908490811115610ad157610ad1614f5d565b02179055506020918201518154610100600160a81b0319166101006001600160a01b03928316021790915586516004840180549183166001600160a01b03199283161790558851600585015587830151600c85018054909216921691909117905586810151600d830155890151610b4b90829085906126f9565b610b675760405162461bcd60e51b815260040161040b90614f71565b86602001516001600160a01b0316827f9d9f66221370175606b4085f28a419b201c9b6dafd9e0c4520e5bf69ea3e166d895f01516002811115610bac57610bac614f5d565b888a604051610bbd93929190615060565b60405180910390a3602086015186515f91610bd791615000565b9050805f03610c0d573415610bfe5760405162461bcd60e51b815260040161040b90615089565b50505050505050505050505050565b60058d015460ff1615610c80576020808901516001600160a01b03165f90815260048f019091526040902054811115610c805760405162461bcd60e51b815260206004820152601560248201527410985b185b98d948195e18d959591cc81b1a5b5a5d605a1b604482015260640161040b565b600188516002811115610c9557610c95614f5d565b03610e7d576060890151878160028110610cb157610cb1614f49565b60200201513414610cf95760405162461bcd60e51b81526020600482015260126024820152710dae6ce5cecc2d8eaca40dad2e6dac2e8c6d60731b604482015260640161040b565b5f888260028110610d0c57610d0c614f49565b60200201511115610d8b57856001600160a01b031663d68d9d4e898360028110610d3857610d38614f49565b6020020151866040518363ffffffff1660e01b8152600401610d5c91815260200190565b5f604051808303818588803b158015610d73575f5ffd5b505af1158015610d85573d5f5f3e3d5ffd5b50505050505b5f610d97826001614fed565b90505f898260028110610dac57610dac614f49565b60200201511115610e765760018f01546001600160a01b0316637e1cd431898360028110610ddc57610ddc614f49565b602002015189888d8660028110610df557610df5614f49565b60200201516040516001600160e01b031960e087901b1681526001600160a01b039485166004820152939092166024840152604483015260648201526084016020604051808303815f875af1158015610e50573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e7491906150b5565b505b5050610bfe565b600288516002811115610e9257610e92614f5d565b03610fac573415610eb55760405162461bcd60e51b815260040161040b90615089565b60208801515f5b6002811015610f2d57888160028110610ed757610ed7614f49565b602002015115610f2557610f25888260028110610ef657610ef6614f49565b6020020151308b8460028110610f0e57610f0e614f49565b60200201516001600160a01b038616929190613147565b600101610ebc565b50610f426001600160a01b03821687846131b4565b60405163030422ed60e61b8152600481018590526001600160a01b0382811660248301526044820184905287169063c108bb40906064015f604051808303815f87803b158015610f90575f5ffd5b505af1158015610fa2573d5f5f3e3d5ffd5b5050505050610bfe565b610bfe614fc5565b5f818152602083905260409020545b92915050565b5f61100883838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061324392505050565b90505f611017825f01516133d4565b805160808201515f828152600689016020526040902092935090916001600382015460ff16600481111561104d5761104d614f5d565b1461106a5760405162461bcd60e51b815260040161040b906150d4565b845180516020918201209086015161108590839083906126f9565b6110a15760405162461bcd60e51b815260040161040b90614f71565b816014015485602001516110b59190614fed565b6001146110d45760405162461bcd60e51b815260040161040b90614f9f565b84606001514311156111285760405162461bcd60e51b815260206004820152601860248201527f576974686472617720646561646c696e65207061737365640000000000000000604482015260640161040b565b604085015180516020808801516014860155909101516111498483836134b0565b6040516364768a4f60e11b8152600481018590525f90819073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c8ed149e9060240160c060405180830381865af415801561119b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111bf9190615195565b925092505086846001600160a01b0316897f1b87d077d9b706e42883b454b67730633fd6b4b29f9a9cf5f57c278c54f51c8f8686868f60200151604051611209949392919061521c565b60405180910390a4610bfe8d8986868b61350b565b5f61125d83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061370192505050565b90505f61126c825f0151613892565b80515f8181526006880160205260409020919250906001600382015460ff16600481111561129c5761129c614f5d565b14806112c057506002600382015460ff1660048111156112be576112be614f5d565b145b6112dc5760405162461bcd60e51b815260040161040b906150d4565b83518051602091820120908501516112f790839083906126f9565b6113135760405162461bcd60e51b815260040161040b90614f71565b5f6040518060400160405280846004015f6002811061133457611334614f49565b60080201546001600160a01b039081168252600c860154166020918201526007850154908701519192501080156113725750600f8301546020860151115b61138e5760405162461bcd60e51b815260040161040b90614f9f565b43856060015110156113db5760405162461bcd60e51b815260206004820152601660248201527514d95d1d1b1948191958591b1a5b99481c185cdcd95960521b604482015260640161040b565b805f60200201516001600160a01b031685604001515f8151811061140157611401614f49565b60200260200101515f01516001600160a01b031614801561145b575080600160200201516001600160a01b0316856040015160018151811061144557611445614f49565b60200260200101515f01516001600160a01b0316145b6114a75760405162461bcd60e51b815260206004820152601860248201527f536574746c65206163636f756e7473206d69736d617463680000000000000000604482015260640161040b565b5f604051806040016040528087604001515f815181106114c9576114c9614f49565b602002602001015160200151815260200187604001516001815181106114f1576114f1614f49565b60209081029190910181015101519052604051636b5c4f1d60e11b81526004810186905290915073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d6b89e3a90602401602060405180830381865af4158015611552573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611576919061524c565b602082015182516115879190615000565b146115cb5760405162461bcd60e51b8152602060048201526014602482015273084c2d8c2dcc6ca40e6eada40dad2e6dac2e8c6d60631b604482015260640161040b565b6115d78a856003612f77565b847f6c666557dc97fd52cd2d9d6dd6d109e501ffdb831abeecf13aafeeaf762ee1fd826040516116079190615263565b60405180910390a26002840154611631908b90879061010090046001600160a01b03168585613a79565b50505050505050505050565b5f838152600685016020526040902060158101336001600384015460ff16600481111561166c5761166c614f5d565b146116895760405162461bcd60e51b815260040161040b906150d4565b81546001600160a01b0316156116e15760405162461bcd60e51b815260206004820152601e60248201527f50656e64696e6720776974686472617720696e74656e74206578697374730000604482015260640161040b565b6116eb83826126c3565b6116f3575f5ffd5b81546001600160a01b0319166001600160a01b0382169081178355600183018690554360028401556003830185905560405186815287907f97883669625c4ff7f5432b4ca33fe75fb5fee985deb196a967e5758f846170fe9060200160405180910390a350505050505050565b5f81815260068301602052604090206001600382015460ff16600481111561178a5761178a614f5d565b146117a75760405162461bcd60e51b815260040161040b906150d4565b60158101546001600160a01b03166118015760405162461bcd60e51b815260206004820152601a60248201527f4e6f2070656e64696e6720776974686472617720696e74656e74000000000000604482015260640161040b565b600181015460178201546118159190615000565b43101561185a5760405162461bcd60e51b8152602060048201526013602482015272111a5cdc1d5d19481b9bdd081d1a5b595bdd5d606a1b604482015260640161040b565b6015810180546016830180546018850180546001600160a01b031985169095555f92839055601786018390558290556001600160a01b0390921692906118a085856127be565b90505f6118ae826001614fed565b9050600486015f8184600281106118c7576118c7614f49565b60080201600301600401548285600281106118e4576118e4614f49565b600802016003016001015483866002811061190157611901614f49565b600802016002015484866002811061191b5761191b614f49565b600802016003016001015485886002811061193857611938614f49565b600802016001015461194a9190615000565b6119549190614fed565b61195e9190614fed565b6119689190614fed565b9050808611156119b25760405162461bcd60e51b8152602060048201526015602482015274115e18d95959081dda5d1a191c985dc81b1a5b5a5d605a1b604482015260640161040b565b6119bd8888886134b0565b6040516364768a4f60e11b8152600481018990525f90819073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c8ed149e9060240160c060405180830381865af4158015611a0f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a339190615195565b925092505086896001600160a01b03168c7fe8110b4ee08638c48f6a4d5f726927df4e541893efa9d2c2c47a6b889041826e8b8686604051611a7793929190615271565b60405180910390a4611a8c8c8c8b8b8b61350b565b505050505050505050505050565b5f818152600683016020526040902060048101436002600384015460ff166004811115611ac957611ac9614f5d565b14611ae65760405162461bcd60e51b815260040161040b906150d4565b8254811015611b375760405162461bcd60e51b815260206004820152601760248201527f536574746c65206973206e6f742066696e616c697a6564000000000000000000604482015260640161040b565b60058201541580611b4b5750600682015481115b8015611b665750600d8201541580611b665750600e82015481115b611bb25760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e747320617265206e6f742066696e616c697a6564000000000000604482015260640161040b565b5f5f611bbd85613b54565b9150915081611c0357611bd08786613d62565b60405186907fa6549eb18490d42e7ec93f42115d1ee11b706d04077be9597034dd73ec8bcb36905f90a250505050505050565b611c0f87866003612f77565b857f728ddd8c5acda5947c34db8d759c66ae70884f526ff9b93637d351b012ef320682604051611c3f9190615263565b60405180910390a260028501546040805180820190915285546001600160a01b039081168252600887015481166020830152610838928a928a926101009092049091169085613a79565b34611c9f858585611c9a8587615000565b613de1565b5f8481526006860160205260409020600160028083015460ff1690811115611cc957611cc9614f5d565b03611dc7578115611d33576003860154604051636b46cea760e11b8152600481018790526001600160a01b039091169063d68d9d4e9084906024015f604051808303818588803b158015611d1b575f5ffd5b505af1158015611d2d573d5f5f3e3d5ffd5b50505050505b8215611dc25760018601546003870154604051637e1cd43160e01b81523360048201526001600160a01b0391821660248201526044810188905260648101869052911690637e1cd431906084016020604051808303815f875af1158015611d9c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dc091906150b5565b505b611eb6565b60028181015460ff1681811115611de057611de0614f5d565b03611eae578115611e035760405162461bcd60e51b815260040161040b90615089565b600281015461010090046001600160a01b0316611e2281333087613147565b6003870154611e3e906001600160a01b038381169116866131b4565b600387015460405163030422ed60e61b8152600481018890526001600160a01b038381166024830152604482018790529091169063c108bb40906064015f604051808303815f87803b158015611e92575f5ffd5b505af1158015611ea4573d5f5f3e3d5ffd5b5050505050611eb6565b611eb6614fc5565b505050505050565b5f611efd83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506123fe92505050565b805180519192505f90611f1890828461034857610348614f49565b90505f5b828110156108385781515f81815260068901602052604090206001600382015460ff166004811115611f5057611f50614f5d565b14611f6d5760405162461bcd60e51b815260040161040b906150d4565b5f865f01518481518110611f8357611f83614f49565b60200260200101515f01518051906020012090505f875f01518581518110611fad57611fad614f49565b6020026020010151602001519050611fd08282856126f99092919063ffffffff16565b611fec5760405162461bcd60e51b815260040161040b90614f71565b5f6120048760200151856127be90919063ffffffff16565b90505f84600401826002811061201c5761201c614f49565b600802016003019050805f015488604001511161204b5760405162461bcd60e51b815260040161040b90614f9f565b604088015181556060880151602090810151015160018083019190915560c0890151600483015561207c908a614fed565b87036120c757857fd0793cc4198bf052a6d91a9a1273c4af39f02a91b0e19029477511c278c5b2716120ad8761403b565b6040516120ba9190615263565b60405180910390a261217a565b6120d260018a614fed565b8710156121725789516120ea906107ae896001615000565b80519098508611156121395760405162461bcd60e51b81526020600482015260186024820152774e6f6e2d617363656e64696e67206368616e6e656c49647360401b604482015260640161040b565b875186101561216d57857fd0793cc4198bf052a6d91a9a1273c4af39f02a91b0e19029477511c278c5b2716120ad8761403b565b61217a565b61217a614fc5565b505060019094019350611f1c92505050565b5f81815260068301602052604090206001600382015460ff1660048111156121b6576121b6614f5d565b146121d35760405162461bcd60e51b815260040161040b906150d4565b60158101546001600160a01b031661222d5760405162461bcd60e51b815260206004820152601a60248201527f4e6f2070656e64696e6720776974686472617720696e74656e74000000000000604482015260640161040b565b61223781336126c3565b61227c5760405162461bcd60e51b815260206004820152601660248201527536b9b39739b2b73232b91034b9903737ba103832b2b960511b604482015260640161040b565b6015810180546001600160a01b03191690555f60168201819055601782018190556018820181905560405183917f9a8a5493b616f074b3f754b5fd66049c8e7980f01547289e5e31808485c6002c91a2505050565b5f84815260068601602052604090206002600382015460ff1660048111156122fb576122fb614f5d565b146123185760405162461bcd60e51b815260040161040b906150d4565b5f61232382866127be565b90505f8484604051612336929190615285565b604051809103902090505f83600401836002811061235657612356614f49565b600802016003019050818160020154146123a75760405162461bcd60e51b8152602060048201526012602482015271098d2e6e840d0c2e6d040dad2e6dac2e8c6d60731b604482015260640161040b565b5f6123e687878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061406392505050565b6020810151600284015590506116318a8a8684612837565b60408051602080820183526060825282518084019093525f80845290830184905290919061242d8260016141e5565b90508060018151811061244257612442614f49565b60200260200101516001600160401b0381111561246157612461615102565b6040519080825280602002602001820160405280156124a657816020015b604080518082019091526060808252602082015281526020019060019003908161247f5790505b50835280515f90829060019081106124c0576124c0614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576124e68461429d565b90925090508160010361256e576125046124ff856142d5565b61438c565b855f01518460018151811061251b5761251b614f49565b60200260200101518151811061253357612533614f49565b60200260200101819052508260018151811061255157612551614f49565b60200260200101805180919061256690615294565b9052506124cf565b612578848261451d565b6124cf565b50505050919050565b61258e614cb3565b604080518082019091525f80825260208201849052805b602083015151835110156126bb576125bc8361429d565b9092509050816001036125e1576125da6125d5846142d5565b614592565b84526125a5565b8160020361260d576125fa6125f5846142d5565b6145a8565b6001600160a01b031660208501526125a5565b816003036126285761261e836145b2565b60408501526125a5565b8160040361264b5761264161263c846142d5565b614621565b60608501526125a5565b8160050361266e5761266461265f846142d5565b614063565b60808501526125a5565b816006036126895761267f836145b2565b60a08501526125a5565b816007036126ac576126a261269d846142d5565b6146a9565b60c08501526125a5565b6126b6838261451d565b6125a5565b505050919050565b60048201545f906001600160a01b03838116911614806126f25750600c8301546001600160a01b038381169116145b9392505050565b5f815160021461270a57505f6126f2565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c849052603c812090805b60028110156127b15761277085828151811061275957612759614f49565b6020026020010151846146de90919063ffffffff16565b915086600401816002811061278757612787614f49565b60080201546001600160a01b038381169116146127a9575f93505050506126f2565b60010161273b565b5060019695505050505050565b60048201545f906001600160a01b03908116908316036127df57505f610fc3565b600c8301546001600160a01b03908116908316036127ff57506001610fc3565b60405162461bcd60e51b815260206004820152600d60248201526c2737b732bc34b9ba103832b2b960991b604482015260640161040b565b5f838152600685016020526040812060028087015484519293926001600160a01b0390911691637cac39cf919060048601908890811061287957612879614f49565b60080201600301600301546040518363ffffffff1660e01b81526004016128a19291906152ac565b5f60405180830381865afa1580156128bb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526128e291908101906152f8565b90505f805b82518110156129b45782818151811061290257612902614f49565b6020026020010151826129159190615000565b915083600401866002811061292c5761292c614f49565b6008020154855180516001600160a01b03909216918390811061295157612951614f49565b6020026020010151887f33252d4bc5cee2ad248475e8c39239a79dc64b2691c9ca1a63ff9af0c75b877686858151811061298d5761298d614f49565b60200260200101516040516129a491815260200190565b60405180910390a46001016128e7565b50808360040186600281106129cb576129cb614f49565b60080201600301600101546129e09190615000565b8360040186600281106129f5576129f5614f49565b60080201600401556020840151612a2f575f836004018660028110612a1c57612a1c614f49565b6008020160030160040181905550610838565b80836004018660028110612a4557612a45614f49565b6008020160030160040154612a5a9190614fed565b836004018660028110612a6f57612a6f614f49565b600802016003016004018190555050505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c839052603c81208190612ac090846146de565b9050612acc85826126c3565b95945050505050565b5f81815260068301602052604090206001810154612af39043615000565b8155612b0183826002612f77565b817f296143e7e25aa055fbb871702776a67da540876e2be721d5c38ba23c97c90d64612b2c8361403b565b604051612b399190615263565b60405180910390a2505050565b60408051808201909152606080825260208201525f612b7783604080518082019091525f8152602081019190915290565b90505f612b858260026141e5565b905080600281518110612b9a57612b9a614f49565b60200260200101516001600160401b03811115612bb957612bb9615102565b604051908082528060200260200182016040528015612bec57816020015b6060815260200190600190039081612bd75790505b5083602001819052505f81600281518110612c0957612c09614f49565b6020026020010181815250505f5f5b6020840151518451101561257d57612c2f8461429d565b909250905081600103612c4c57612c45846142d5565b8552612c18565b81600203612cc857612c5d846142d5565b856020015184600281518110612c7557612c75614f49565b602002602001015181518110612c8d57612c8d614f49565b602002602001018190525082600281518110612cab57612cab614f49565b602002602001018051809190612cc090615294565b905250612c18565b612cd2848261451d565b612c18565b612d1e6040805161010081019091525f60c0820181815260e083019190915260808201908152606060a0830152819081526020015f81526020015f81526020015f81525090565b604080518082019091525f80825260208201849052805b602083015151835110156126bb57612d4c8361429d565b909250905081600103612d7157612d6a612d65846142d5565b614706565b8452612d35565b81600203612d8c57612d82836145b2565b6020850152612d35565b81600303612da757612d9d836145b2565b6040850152612d35565b81600403612dc257612db8836145b2565b6060850152612d35565b612dcc838261451d565b612d35565b6040805160028082526060820183525f92839283929091602083019080368337505086518251929350918391505f90612e0c57612e0c614f49565b6001600160a01b0392909216602092830291909101820152850151815182906001908110612e3c57612e3c614f49565b6001600160a01b039283166020918202929092010152604051630d63a1fd60e01b81525f91881690630d63a1fd90612e7c90859030908a906004016153a2565b6020604051808303815f875af1158015612e98573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ebc919061524c565b905080612efe5760405162461bcd60e51b815260206004820152601060248201526f06368616e6e656c4964206765747320360841b604482015260640161040b565b5f818152600689016020526040812090600382015460ff166004811115612f2757612f27614f5d565b14612f695760405162461bcd60e51b815260206004820152601260248201527113d8d8dd5c1a59590818da185b9b995b125960721b604482015260640161040b565b909890975095505050505050565b806004811115612f8957612f89614f5d565b600383015460ff166004811115612fa257612fa2614f5d565b03612fac57505050565b5f600383015460ff166004811115612fc657612fc6614f5d565b1461303157600382015460019084905f9060ff166004811115612feb57612feb614f5d565b81526020019081526020015f20546130039190614fed565b600383015484905f9060ff16600481111561302057613020614f5d565b815260208101919091526040015f20555b825f82600481111561304557613045614f5d565b81526020019081526020015f2054600161305f9190615000565b835f83600481111561307357613073614f5d565b815260208101919091526040015f205560038201805482919060ff191660018360048111156130a4576130a4614f5d565b0217905550505050565b604080518082019091525f80825260208201526001825160028111156130d6576130d6614f5d565b036130f65760208201516001600160a01b0316156130f2575f5ffd5b5090565b60028251600281111561310b5761310b614f5d565b0361313f5760208201516001600160a01b0316613126575f5ffd5b5f82602001516001600160a01b03163b116130f2575f5ffd5b6130f2614fc5565b6040516001600160a01b0384811660248301528381166044830152606482018390526131ae9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506148b3565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052613205848261491f565b6131ae576040516001600160a01b0384811660248301525f604483015261323991869182169063095ea7b39060640161317c565b6131ae84826148b3565b60408051808201909152606080825260208201525f61327483604080518082019091525f8152602081019190915290565b90505f6132828260026141e5565b90508060028151811061329757613297614f49565b60200260200101516001600160401b038111156132b6576132b6615102565b6040519080825280602002602001820160405280156132e957816020015b60608152602001906001900390816132d45790505b5083602001819052505f8160028151811061330657613306614f49565b6020026020010181815250505f5f5b6020840151518451101561257d5761332c8461429d565b90925090508160010361334957613342846142d5565b8552613315565b816002036133c55761335a846142d5565b85602001518460028151811061337257613372614f49565b60200260200101518151811061338a5761338a614f49565b6020026020010181905250826002815181106133a8576133a8614f49565b6020026020010180518091906133bd90615294565b905250613315565b6133cf848261451d565b613315565b6133dc614d14565b604080518082019091525f80825260208201849052805b602083015151835110156126bb5761340a8361429d565b90925090508160010361342a576134236125d5846142d5565b84526133f3565b816002036134455761343b836145b2565b60208501526133f3565b816003036134685761345e613459846142d5565b614968565b60408501526133f3565b8160040361348357613479836145b2565b60608501526133f3565b816005036134a1576134976125d5846142d5565b60808501526133f3565b6134ab838261451d565b6133f3565b5f6134bb84846127be565b9050818460040182600281106134d3576134d3614f49565b60080201600201546134e59190615000565b8460040182600281106134fa576134fa614f49565b600802016002018190555050505050565b81156136fa575f8481526006860160205260409020816135a5576003860154600282015460405163470660bb60e11b8152600481018890526001600160a01b0361010090920482166024820152868216604482015260648101869052911690638e0cc176906084015f604051808303815f87803b15801561358a575f5ffd5b505af115801561359c573d5f5f3e3d5ffd5b50505050611eb6565b5f828152600687016020526040902060028082015460ff16908111156135cd576135cd614f5d565b60028084015460ff16908111156135e6576135e6614f5d565b148015613611575060028181015490830154610100918290046001600160a01b039081169290910416145b6136695760405162461bcd60e51b815260206004820152602360248201527f546f6b656e206d69736d61746368206f6620726563697069656e74206368616e6044820152621b995b60ea1b606482015260840161040b565b61367587848787613de1565b6003870154600283015460405163405d4a9760e11b815260048101899052602481018690526001600160a01b03610100909204821660448201528782166064820152608481018790529116906380ba952e9060a4015f604051808303815f87803b1580156136e1575f5ffd5b505af11580156136f3573d5f5f3e3d5ffd5b5050505050505b5050505050565b60408051808201909152606080825260208201525f61373283604080518082019091525f8152602081019190915290565b90505f6137408260026141e5565b90508060028151811061375557613755614f49565b60200260200101516001600160401b0381111561377457613774615102565b6040519080825280602002602001820160405280156137a757816020015b60608152602001906001900390816137925790505b5083602001819052505f816002815181106137c4576137c4614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576137ea8461429d565b90925090508160010361380757613800846142d5565b85526137d3565b8160020361388357613818846142d5565b85602001518460028151811061383057613830614f49565b60200260200101518151811061384857613848614f49565b60200260200101819052508260028151811061386657613866614f49565b60200260200101805180919061387b90615294565b9052506137d3565b61388d848261451d565b6137d3565b6138ba60405180608001604052805f81526020015f8152602001606081526020015f81525090565b604080518082019091525f808252602082018490526138da8260046141e5565b9050806003815181106138ef576138ef614f49565b60200260200101516001600160401b0381111561390e5761390e615102565b60405190808252806020026020018201604052801561395257816020015b604080518082019091525f808252602082015281526020019060019003908161392c5790505b5083604001819052505f8160038151811061396f5761396f614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576139958461429d565b9092509050816001036139b5576139ae6125d5856142d5565b855261397e565b816002036139d0576139c6846145b2565b602086015261397e565b81600303613a4f576139e4613459856142d5565b8560400151846003815181106139fc576139fc614f49565b602002602001015181518110613a1457613a14614f49565b602002602001018190525082600381518110613a3257613a32614f49565b602002602001018051809190613a4790615294565b90525061397e565b81600403613a6a57613a60846145b2565b606086015261397e565b613a74848261451d565b61397e565b5f5b6002811015611eb657818160028110613a9657613a96614f49565b602002015115613b4c5760038601546001600160a01b0316638e0cc1768686868560028110613ac757613ac7614f49565b6020020151868660028110613ade57613ade614f49565b60200201516040516001600160e01b031960e087901b16815260048101949094526001600160a01b0392831660248501529116604483015260648201526084015f604051808303815f87803b158015613b35575f5ffd5b505af1158015613b47573d5f5f3e3d5ffd5b505050505b600101613a7b565b5f613b5d614d44565b604080518082019091525f9060048501600283835b82821015613c0257604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101613b72565b5050505090505f604051806040016040528083600160028110613c2757613c27614f49565b60200201516060015160200151845f60028110613c4657613c46614f49565b602002015160200151613c599190615000565b8152835160600151602090810151818601518201519190920191613c7c91615000565b905290505f5b6002811015613d55575f838260028110613c9e57613c9e614f49565b602002015160400151848360028110613cb957613cb9614f49565b60200201516060015160200151613cd09190615000565b905080838360028110613ce557613ce5614f49565b60200201511015613d13575f60405180604001604052805f81526020015f8152509550955050505050915091565b80838360028110613d2657613d26614f49565b6020020151613d359190614fed565b838360028110613d4757613d47614f49565b602002015250600101613c82565b5060019590945092505050565b5f8155613d7182826001612f77565b5f600782018190556008820181905560098201819055600a8201819055600b8201819055600f8201819055601082018190556011820181905560128201819055601382018190556015820180546001600160a01b0319169055601682018190556017820181905560189091015550565b5f83815260068501602052604090206001600382015460ff166004811115613e0b57613e0b614f5d565b14613e285760405162461bcd60e51b815260040161040b906150d4565b5f613e3382856127be565b600587015490915060ff1615613f2957600282015461010090046001600160a01b03165f9081526004878101602052604091829020549151636b5c4f1d60e11b815290810184905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d6b89e3a90602401602060405180830381865af4158015613eb5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613ed9919061524c565b613ee39085615000565b1115613f295760405162461bcd60e51b815260206004820152601560248201527410985b185b98d948195e18d959591cc81b1a5b5a5d605a1b604482015260640161040b565b82826004018260028110613f3f57613f3f614f49565b6008020160010154613f519190615000565b826004018260028110613f6657613f66614f49565b60080201600101819055505f5f5f8473__$13d4168a6482a4756bee5acfadcccc5f1f$__63c8ed149e90916040518263ffffffff1660e01b8152600401613faf91815260200190565b60c060405180830381865af4158015613fca573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613fee9190615195565b925092509250877fb63f5dc096f516663ffb5ef2b611f0e2acca8617a868c2a3653cba5e3ed0e92c84848460405161402893929190615402565b60405180910390a2505050505050505050565b614043614d44565b506040805180820190915260078201548152600f90910154602082015290565b604080518082018252606081525f6020808301829052835180850190945281845283018490529091906140978260026141e5565b9050806001815181106140ac576140ac614f49565b60200260200101516001600160401b038111156140cb576140cb615102565b6040519080825280602002602001820160405280156140f4578160200160208202803683370190505b50835280515f908290600190811061410e5761410e614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576141348461429d565b9092509050816001036141b85761414d6125d5856142d5565b855f01518460018151811061416457614164614f49565b60200260200101518151811061417c5761417c614f49565b6020026020010181815250508260018151811061419b5761419b614f49565b6020026020010180518091906141b090615294565b90525061411d565b816002036141d6576141cc6125d5856142d5565b602086015261411d565b6141e0848261451d565b61411d565b81516060906141f5836001615000565b6001600160401b0381111561420c5761420c615102565b604051908082528060200260200182016040528015614235578160200160208202803683370190505b5091505f5f5b60208601515186511015614294576142528661429d565b8092508193505050600184838151811061426e5761426e614f49565b602002602001018181516142829190615000565b90525061428f868261451d565b61423b565b50509092525090565b5f5f5f6142a9846145b2565b90506142b660088261542a565b92508060071660058111156142cd576142cd614f5d565b915050915091565b60605f6142e1836145b2565b90505f81845f01516142f39190615000565b9050836020015151811115614306575f5ffd5b816001600160401b0381111561431e5761431e615102565b6040519080825280601f01601f191660200182016040528015614348576020820181803683370190505b5060208086015186519295509181860191908301015f5b8581101561438157818101518382015261437a602082615000565b905061435f565b505050935250919050565b60408051808201909152606080825260208201525f6143bd83604080518082019091525f8152602081019190915290565b90505f6143cb8260026141e5565b9050806002815181106143e0576143e0614f49565b60200260200101516001600160401b038111156143ff576143ff615102565b60405190808252806020026020018201604052801561443257816020015b606081526020019060019003908161441d5790505b5083602001819052505f8160028151811061444f5761444f614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576144758461429d565b9092509050816001036144925761448b846142d5565b855261445e565b8160020361450e576144a3846142d5565b8560200151846002815181106144bb576144bb614f49565b6020026020010151815181106144d3576144d3614f49565b6020026020010181905250826002815181106144f1576144f1614f49565b60200260200101805180919061450690615294565b90525061445e565b614518848261451d565b61445e565b5f81600581111561453057614530614f5d565b036145435761453e826145b2565b505050565b600281600581111561455757614557614f5d565b036100fb575f614566836145b2565b905080835f018181516145799190615000565b9052506020830151518351111561453e575f5ffd5b5050565b5f81516020146145a0575f5ffd5b506020015190565b5f610fc3826149ff565b60208082015182518101909101515f9182805b600a8110156100fb5783811a91506145de816007615449565b82607f16901b85179450816080165f03614619576145fd816001615000565b8651879061460c908390615000565b9052509395945050505050565b6001016145c5565b614629614d62565b604080518082019091525f80825260208201849052805b602083015151835110156126bb576146578361429d565b90925090508160010361467c57614675614670846142d5565b614a1c565b8452614640565b8160020361469a57614690613459846142d5565b6020850152614640565b6146a4838261451d565b614640565b5f6020825111156146b8575f5ffd5b60208201519050815160206146cd9190614fed565b6146d8906008615449565b1c919050565b5f5f5f5f6146ec8686614aea565b9250925092506146fc8282614b33565b5090949350505050565b604080516080810182525f91810182815260608083019390935281526020810191909152604080518082019091525f8082526020820184905261474a8260026141e5565b90508060028151811061475f5761475f614f49565b60200260200101516001600160401b0381111561477e5761477e615102565b6040519080825280602002602001820160405280156147c257816020015b604080518082019091525f808252602082015281526020019060019003908161479c5790505b5083602001819052505f816002815181106147df576147df614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576148058461429d565b9092509050816001036148255761481e614670856142d5565b85526147ee565b816002036148a457614839613459856142d5565b85602001518460028151811061485157614851614f49565b60200260200101518151811061486957614869614f49565b60200260200101819052508260028151811061488757614887614f49565b60200260200101805180919061489c90615294565b9052506147ee565b6148ae848261451d565b6147ee565b5f5f60205f8451602086015f885af1806148d2576040513d5f823e3d81fd5b50505f513d915081156148e95780600114156148f6565b6001600160a01b0384163b155b156131ae57604051635274afe760e01b81526001600160a01b038516600482015260240161040b565b5f5f5f5f60205f8651602088015f8a5af192503d91505f51905082801561495e57508115614950578060011461495e565b5f866001600160a01b03163b115b9695505050505050565b6040805180820182525f808252602080830182905283518085019094528184528301849052909190805b602083015151835110156126bb576149a98361429d565b9092509050816001036149d2576149c26125f5846142d5565b6001600160a01b03168452614992565b816002036149f0576149e661269d846142d5565b6020850152614992565b6149fa838261451d565b614992565b5f8151601414614a0d575f5ffd5b5060200151600160601b900490565b604080518082019091525f8082526020820152604080518082019091525f80825260208201849052505f5f5b602083015151835110156126bb57614a5f8361429d565b909250905081600103614ab457614a75836145b2565b6002811115614a8657614a86614f5d565b84906002811115614a9957614a99614f5d565b90816002811115614aac57614aac614f5d565b905250614a48565b81600203614adb57614ac86125f5846142d5565b6001600160a01b03166020850152614a48565b614ae5838261451d565b614a48565b5f5f5f8351604103614b21576020840151604085015160608601515f1a614b1388828585614beb565b955095509550505050614b2c565b505081515f91506002905b9250925092565b5f826003811115614b4657614b46614f5d565b03614b4f575050565b6001826003811115614b6357614b63614f5d565b03614b815760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115614b9557614b95614f5d565b03614bb65760405163fce698f760e01b81526004810182905260240161040b565b6003826003811115614bca57614bca614f5d565b0361458e576040516335e2f38360e21b81526004810182905260240161040b565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115614c2457505f91506003905082614ca9565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015614c75573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116614ca057505f925060019150829050614ca9565b92505f91508190505b9450945094915050565b6040518060e001604052805f81526020015f6001600160a01b031681526020015f8152602001614ce1614d62565b8152602001614d026040518060400160405280606081526020015f81525090565b81526020015f81526020015f81525090565b6040518060a001604052805f81526020015f8152602001614d02604080518082019091525f808252602082015290565b60405180604001604052806002906020820280368337509192915050565b604080516080810182525f91810182815260608201929092529081908152602001614d9c604080518082019091525f808252602082015290565b905290565b5f5f83601f840112614db1575f5ffd5b5081356001600160401b03811115614dc7575f5ffd5b602083019150836020828501011115614dde575f5ffd5b9250929050565b5f5f5f60408486031215614df7575f5ffd5b8335925060208401356001600160401b03811115614e13575f5ffd5b614e1f86828701614da1565b9497909650939450505050565b5f60208284031215614e3c575f5ffd5b5035919050565b5f5f60408385031215614e54575f5ffd5b50508035926020909101359150565b5f5f5f5f60808587031215614e76575f5ffd5b5050823594602084013594506040840135936060013592509050565b6001600160a01b0381168114614ea6575f5ffd5b50565b5f5f5f5f60808587031215614ebc575f5ffd5b84359350602085013592506040850135614ed581614e92565b9396929550929360600135925050565b5f5f5f5f5f60808688031215614ef9575f5ffd5b85359450602086013593506040860135614f1281614e92565b925060608601356001600160401b03811115614f2c575f5ffd5b614f3888828901614da1565b969995985093965092949392505050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b60208082526014908201527310da1958dac818dbcb5cda59dcc819985a5b195960621b604082015260600190565b6020808252600c908201526b39b2b8a73ab69032b93937b960a11b604082015260600190565b634e487b7160e01b5f52600160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b81810381811115610fc357610fc3614fd9565b80820180821115610fc357610fc3614fd9565b805f5b60028110156131ae5781516001600160a01b0316845260209384019390910190600101615016565b805f5b60028110156131ae578151845260209384019390910190600101615041565b83815260a081016150746020830185615013565b615081606083018461503e565b949350505050565b60208082526012908201527106d73672e76616c7565206973206e6f7420360741b604082015260600190565b5f602082840312156150c5575f5ffd5b815180151581146126f2575f5ffd5b60208082526014908201527321b430b73732b61039ba30ba3ab99032b93937b960611b604082015260600190565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561513e5761513e615102565b604052919050565b5f82601f830112615155575f5ffd5b61515f6040615116565b806040840185811115615170575f5ffd5b845b8181101561518a578051845260209384019301615172565b509095945050505050565b5f5f5f60c084860312156151a7575f5ffd5b84601f8501126151b5575f5ffd5b6151bf6040615116565b8060408601878111156151d0575f5ffd5b865b818110156151f35780516151e581614e92565b8452602093840193016151d2565b508195506152018882615146565b94505050506152138560808601615146565b90509250925092565b84815260c08101615230602083018661503e565b61523d606083018561503e565b8260a083015295945050505050565b5f6020828403121561525c575f5ffd5b5051919050565b60408101610fc3828461503e565b83815260a08101615074602083018561503e565b818382375f9101908152919050565b5f600182016152a5576152a5614fd9565b5060010190565b604080825283519082018190525f9060208501906060840190835b818110156152e55783518352602093840193909201916001016152c7565b5050602093909301939093525092915050565b5f60208284031215615308575f5ffd5b81516001600160401b0381111561531d575f5ffd5b8201601f8101841361532d575f5ffd5b80516001600160401b0381111561534657615346615102565b8060051b61535660208201615116565b91825260208184018101929081019087841115615371575f5ffd5b6020850194505b8385101561539757845180835260209586019590935090910190615378565b979650505050505050565b606080825284519082018190525f9060208601906080840190835b818110156153e45783516001600160a01b03168352602093840193909201916001016153bd565b50506001600160a01b03959095166020840152505060400152919050565b60c081016154108286615013565b61541d604083018561503e565b615081608083018461503e565b5f8261544457634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610fc357610fc3614fd956fea2646970667358221220387fa1669c9ceb5511d4b17c62f6a71a75022398c7238dcea6dff6c9df1b2cbd64736f6c634300081e0033", + Bin: "0x615496610034600b8282823980515f1a607314602857634e487b7160e01b5f525f60045260245ffd5b305f52607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100fb575f3560e01c806383e0fef51161009e578063c98c92511161006e578063c98c925114610273578063e59f368614610291578063eb4de337146102b0578063ff7fb411146102cf575f5ffd5b806383e0fef5146101f8578063bb3d0f2b14610217578063bd199ca514610236578063bd9d315714610254575f5ffd5b806360297df3116100d957806360297df31461017a578063742fb5071461019b57806379e90087146101ba5780637a2654ed146101d9575f5ffd5b80630bdc5411146100ff57806344e58d5114610120578063594db6e31461015b575b5f5ffd5b81801561010a575f5ffd5b5061011e610119366004614de5565b6102ee565b005b61013e61012e366004614e2c565b600201546001600160a01b031690565b6040516001600160a01b0390911681526020015b60405180910390f35b818015610166575f5ffd5b5061011e610175366004614de5565b610841565b61018d610188366004614e43565b610fb4565b604051908152602001610152565b8180156101a6575f5ffd5b5061011e6101b5366004614de5565b610fc9565b8180156101c5575f5ffd5b5061011e6101d4366004614de5565b61121e565b8180156101e4575f5ffd5b5061011e6101f3366004614e63565b61163d565b818015610203575f5ffd5b5061011e610212366004614e43565b611760565b818015610222575f5ffd5b5061011e610231366004614e43565b611a9a565b61013e610244366004614e2c565b600301546001600160a01b031690565b81801561025f575f5ffd5b5061011e61026e366004614ea9565b611c89565b61013e610281366004614e2c565b600101546001600160a01b031690565b81801561029c575f5ffd5b5061011e6102ab366004614de5565b611ebe565b8180156102bb575f5ffd5b5061011e6102ca366004614e43565b61218c565b8180156102da575f5ffd5b5061011e6102e9366004614ee5565b6122d1565b5f61032d83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506123fe92505050565b805180519192505f9061035890828461034857610348614f49565b60200260200101515f0151612586565b90505f5b828110156108385781515f818152600689016020526040902061037f81336126c3565b15610419576001600382015460ff16600481111561039f5761039f614f5d565b14806103c357506002600382015460ff1660048111156103c1576103c1614f5d565b145b6104145760405162461bcd60e51b815260206004820152601960248201527f50656572206368616e6e656c20737461747573206572726f720000000000000060448201526064015b60405180910390fd5b610481565b6002600382015460ff16600481111561043457610434614f5d565b146104815760405162461bcd60e51b815260206004820152601c60248201527f4e6f6e70656572206368616e6e656c20737461747573206572726f7200000000604482015260640161040b565b8054158061048f5750805442105b6104db5760405162461bcd60e51b815260206004820152601c60248201527f536574746c652068617320616c72656164792066696e616c697a656400000000604482015260640161040b565b5f865f015184815181106104f1576104f1614f49565b60200260200101515f01518051906020012090505f875f0151858151811061051b5761051b614f49565b60200260200101516020015190505f86604001511115610695576105408383836126f9565b61055c5760405162461bcd60e51b815260040161040b90614f71565b5f6105748760200151856127be90919063ffffffff16565b90505f84600401826002811061058c5761058c614f49565b600802016003019050600160048111156105a8576105a8614f5d565b600386015460ff1660048111156105c1576105c1614f5d565b036105f0578054604089015110156105eb5760405162461bcd60e51b815260040161040b90614f9f565b61063c565b6002600386015460ff16600481111561060b5761060b614f5d565b036106345780546040890151116105eb5760405162461bcd60e51b815260040161040b90614f9f565b61063c614fc5565b6040880151815560608801516020908101518101516001830155608089015101516002820181905560a089015160038301551561067e5760c088015160048201555b61068e8d87848b60800151612837565b505061076b565b85604001515f03610763578254156106e55760405162461bcd60e51b8152602060048201526013602482015272696e74656e64536574746c65206265666f726560681b604482015260640161040b565b8051600114801561071f575061071f82825f8151811061070757610707614f49565b602002602001015185612a869092919063ffffffff16565b61075e5760405162461bcd60e51b815260206004820152601060248201526f10da1958dac81cda59c819985a5b195960821b604482015260640161040b565b61076b565b61076b614fc5565b610776600188614fed565b850361078b576107868b85612ad5565b610828565b610796600188614fed565b8510156108205787516107be906107ae876001615000565b8151811061034857610348614f49565b805190965084111561080d5760405162461bcd60e51b81526020600482015260186024820152774e6f6e2d617363656e64696e67206368616e6e656c49647360401b604482015260640161040b565b8551841015610786576107868b85612ad5565b610828614fc5565b50506001909201915061035c9050565b50505050505050565b5f61088083838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250612b4692505050565b90505f61088f825f0151612cd7565b805160200151519091506002146108d75760405162461bcd60e51b815260206004820152600c60248201526b0aee4dedcce40d8cadccee8d60a31b604482015260640161040b565b80602001514211156109225760405162461bcd60e51b815260206004820152601460248201527313dc195b88191958591b1a5b99481c185cdcd95960621b604482015260640161040b565b8051516040805180820190915282516020015180515f92918291849061094a5761094a614f49565b6020026020010151602001518152602001845f01516020015160018151811061097557610975614f49565b60200260200101516020015181525090505f6040518060400160405280855f0151602001515f815181106109ab576109ab614f49565b60200260200101515f01516001600160a01b03166001600160a01b03168152602001855f0151602001516001815181106109e7576109e7614f49565b602090810291909101810151516001600160a01b0390811690925282015182519293508116911610610a5b5760405162461bcd60e51b815260206004820152601c60248201527f5065657220616464727320617265206e6f7420617363656e64696e6700000000604482015260640161040b565b6003880154855180516020909101206001600160a01b03909116905f80610a848c858786612dd1565b9150915087604001518160010181905550610aa18c826001612f77565b610aaa876130ae565b805160028084018054909291839160ff1916906001908490811115610ad157610ad1614f5d565b02179055506020918201518154610100600160a81b0319166101006001600160a01b03928316021790915586516004840180549183166001600160a01b03199283161790558851600585015587830151600c85018054909216921691909117905586810151600d830155890151610b4b90829085906126f9565b610b675760405162461bcd60e51b815260040161040b90614f71565b86602001516001600160a01b0316827f9d9f66221370175606b4085f28a419b201c9b6dafd9e0c4520e5bf69ea3e166d895f01516002811115610bac57610bac614f5d565b888a604051610bbd93929190615060565b60405180910390a3602086015186515f91610bd791615000565b9050805f03610c0d573415610bfe5760405162461bcd60e51b815260040161040b90615089565b50505050505050505050505050565b60058d015460ff1615610c80576020808901516001600160a01b03165f90815260048f019091526040902054811115610c805760405162461bcd60e51b815260206004820152601560248201527410985b185b98d948195e18d959591cc81b1a5b5a5d605a1b604482015260640161040b565b600188516002811115610c9557610c95614f5d565b03610e7d576060890151878160028110610cb157610cb1614f49565b60200201513414610cf95760405162461bcd60e51b81526020600482015260126024820152710dae6ce5cecc2d8eaca40dad2e6dac2e8c6d60731b604482015260640161040b565b5f888260028110610d0c57610d0c614f49565b60200201511115610d8b57856001600160a01b031663d68d9d4e898360028110610d3857610d38614f49565b6020020151866040518363ffffffff1660e01b8152600401610d5c91815260200190565b5f604051808303818588803b158015610d73575f5ffd5b505af1158015610d85573d5f5f3e3d5ffd5b50505050505b5f610d97826001614fed565b90505f898260028110610dac57610dac614f49565b60200201511115610e765760018f01546001600160a01b0316637e1cd431898360028110610ddc57610ddc614f49565b602002015189888d8660028110610df557610df5614f49565b60200201516040516001600160e01b031960e087901b1681526001600160a01b039485166004820152939092166024840152604483015260648201526084016020604051808303815f875af1158015610e50573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e7491906150b5565b505b5050610bfe565b600288516002811115610e9257610e92614f5d565b03610fac573415610eb55760405162461bcd60e51b815260040161040b90615089565b60208801515f5b6002811015610f2d57888160028110610ed757610ed7614f49565b602002015115610f2557610f25888260028110610ef657610ef6614f49565b6020020151308b8460028110610f0e57610f0e614f49565b60200201516001600160a01b038616929190613147565b600101610ebc565b50610f426001600160a01b03821687846131b4565b60405163030422ed60e61b8152600481018590526001600160a01b0382811660248301526044820184905287169063c108bb40906064015f604051808303815f87803b158015610f90575f5ffd5b505af1158015610fa2573d5f5f3e3d5ffd5b5050505050610bfe565b610bfe614fc5565b5f818152602083905260409020545b92915050565b5f61100883838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061324392505050565b90505f611017825f01516133d4565b805160808201515f828152600689016020526040902092935090916001600382015460ff16600481111561104d5761104d614f5d565b1461106a5760405162461bcd60e51b815260040161040b906150d4565b845180516020918201209086015161108590839083906126f9565b6110a15760405162461bcd60e51b815260040161040b90614f71565b816014015485602001516110b59190614fed565b6001146110d45760405162461bcd60e51b815260040161040b90614f9f565b84606001514211156111285760405162461bcd60e51b815260206004820152601860248201527f576974686472617720646561646c696e65207061737365640000000000000000604482015260640161040b565b604085015180516020808801516014860155909101516111498483836134b0565b6040516364768a4f60e11b8152600481018590525f90819073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c8ed149e9060240160c060405180830381865af415801561119b573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111bf9190615195565b925092505086846001600160a01b0316897f1b87d077d9b706e42883b454b67730633fd6b4b29f9a9cf5f57c278c54f51c8f8686868f60200151604051611209949392919061521c565b60405180910390a4610bfe8d8986868b61350b565b5f61125d83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061370192505050565b90505f61126c825f0151613892565b80515f8181526006880160205260409020919250906001600382015460ff16600481111561129c5761129c614f5d565b14806112c057506002600382015460ff1660048111156112be576112be614f5d565b145b6112dc5760405162461bcd60e51b815260040161040b906150d4565b83518051602091820120908501516112f790839083906126f9565b6113135760405162461bcd60e51b815260040161040b90614f71565b5f6040518060400160405280846004015f6002811061133457611334614f49565b60080201546001600160a01b039081168252600c860154166020918201526007850154908701519192501080156113725750600f8301546020860151115b61138e5760405162461bcd60e51b815260040161040b90614f9f565b42856060015110156113db5760405162461bcd60e51b815260206004820152601660248201527514d95d1d1b1948191958591b1a5b99481c185cdcd95960521b604482015260640161040b565b805f60200201516001600160a01b031685604001515f8151811061140157611401614f49565b60200260200101515f01516001600160a01b031614801561145b575080600160200201516001600160a01b0316856040015160018151811061144557611445614f49565b60200260200101515f01516001600160a01b0316145b6114a75760405162461bcd60e51b815260206004820152601860248201527f536574746c65206163636f756e7473206d69736d617463680000000000000000604482015260640161040b565b5f604051806040016040528087604001515f815181106114c9576114c9614f49565b602002602001015160200151815260200187604001516001815181106114f1576114f1614f49565b60209081029190910181015101519052604051636b5c4f1d60e11b81526004810186905290915073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d6b89e3a90602401602060405180830381865af4158015611552573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611576919061524c565b602082015182516115879190615000565b146115cb5760405162461bcd60e51b8152602060048201526014602482015273084c2d8c2dcc6ca40e6eada40dad2e6dac2e8c6d60631b604482015260640161040b565b6115d78a856003612f77565b847f6c666557dc97fd52cd2d9d6dd6d109e501ffdb831abeecf13aafeeaf762ee1fd826040516116079190615263565b60405180910390a26002840154611631908b90879061010090046001600160a01b03168585613a79565b50505050505050505050565b5f838152600685016020526040902060158101336001600384015460ff16600481111561166c5761166c614f5d565b146116895760405162461bcd60e51b815260040161040b906150d4565b81546001600160a01b0316156116e15760405162461bcd60e51b815260206004820152601e60248201527f50656e64696e6720776974686472617720696e74656e74206578697374730000604482015260640161040b565b6116eb83826126c3565b6116f3575f5ffd5b81546001600160a01b0319166001600160a01b0382169081178355600183018690554260028401556003830185905560405186815287907f97883669625c4ff7f5432b4ca33fe75fb5fee985deb196a967e5758f846170fe9060200160405180910390a350505050505050565b5f81815260068301602052604090206001600382015460ff16600481111561178a5761178a614f5d565b146117a75760405162461bcd60e51b815260040161040b906150d4565b60158101546001600160a01b03166118015760405162461bcd60e51b815260206004820152601a60248201527f4e6f2070656e64696e6720776974686472617720696e74656e74000000000000604482015260640161040b565b600181015460178201546118159190615000565b42101561185a5760405162461bcd60e51b8152602060048201526013602482015272111a5cdc1d5d19481b9bdd081d1a5b595bdd5d606a1b604482015260640161040b565b6015810180546016830180546018850180546001600160a01b031985169095555f92839055601786018390558290556001600160a01b0390921692906118a085856127be565b90505f6118ae826001614fed565b9050600486015f8184600281106118c7576118c7614f49565b60080201600301600401548285600281106118e4576118e4614f49565b600802016003016001015483866002811061190157611901614f49565b600802016002015484866002811061191b5761191b614f49565b600802016003016001015485886002811061193857611938614f49565b600802016001015461194a9190615000565b6119549190614fed565b61195e9190614fed565b6119689190614fed565b9050808611156119b25760405162461bcd60e51b8152602060048201526015602482015274115e18d95959081dda5d1a191c985dc81b1a5b5a5d605a1b604482015260640161040b565b6119bd8888886134b0565b6040516364768a4f60e11b8152600481018990525f90819073__$13d4168a6482a4756bee5acfadcccc5f1f$__9063c8ed149e9060240160c060405180830381865af4158015611a0f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a339190615195565b925092505086896001600160a01b03168c7fe8110b4ee08638c48f6a4d5f726927df4e541893efa9d2c2c47a6b889041826e8b8686604051611a7793929190615271565b60405180910390a4611a8c8c8c8b8b8b61350b565b505050505050505050505050565b5f818152600683016020526040902060048101426002600384015460ff166004811115611ac957611ac9614f5d565b14611ae65760405162461bcd60e51b815260040161040b906150d4565b8254811015611b375760405162461bcd60e51b815260206004820152601760248201527f536574746c65206973206e6f742066696e616c697a6564000000000000000000604482015260640161040b565b60058201541580611b4b5750600682015481115b8015611b665750600d8201541580611b665750600e82015481115b611bb25760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e747320617265206e6f742066696e616c697a6564000000000000604482015260640161040b565b5f5f611bbd85613b54565b9150915081611c0357611bd08786613d62565b60405186907fa6549eb18490d42e7ec93f42115d1ee11b706d04077be9597034dd73ec8bcb36905f90a250505050505050565b611c0f87866003612f77565b857f728ddd8c5acda5947c34db8d759c66ae70884f526ff9b93637d351b012ef320682604051611c3f9190615263565b60405180910390a260028501546040805180820190915285546001600160a01b039081168252600887015481166020830152610838928a928a926101009092049091169085613a79565b34611c9f858585611c9a8587615000565b613de1565b5f8481526006860160205260409020600160028083015460ff1690811115611cc957611cc9614f5d565b03611dc7578115611d33576003860154604051636b46cea760e11b8152600481018790526001600160a01b039091169063d68d9d4e9084906024015f604051808303818588803b158015611d1b575f5ffd5b505af1158015611d2d573d5f5f3e3d5ffd5b50505050505b8215611dc25760018601546003870154604051637e1cd43160e01b81523360048201526001600160a01b0391821660248201526044810188905260648101869052911690637e1cd431906084016020604051808303815f875af1158015611d9c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611dc091906150b5565b505b611eb6565b60028181015460ff1681811115611de057611de0614f5d565b03611eae578115611e035760405162461bcd60e51b815260040161040b90615089565b600281015461010090046001600160a01b0316611e2281333087613147565b6003870154611e3e906001600160a01b038381169116866131b4565b600387015460405163030422ed60e61b8152600481018890526001600160a01b038381166024830152604482018790529091169063c108bb40906064015f604051808303815f87803b158015611e92575f5ffd5b505af1158015611ea4573d5f5f3e3d5ffd5b5050505050611eb6565b611eb6614fc5565b505050505050565b5f611efd83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506123fe92505050565b805180519192505f90611f1890828461034857610348614f49565b90505f5b828110156108385781515f81815260068901602052604090206001600382015460ff166004811115611f5057611f50614f5d565b14611f6d5760405162461bcd60e51b815260040161040b906150d4565b5f865f01518481518110611f8357611f83614f49565b60200260200101515f01518051906020012090505f875f01518581518110611fad57611fad614f49565b6020026020010151602001519050611fd08282856126f99092919063ffffffff16565b611fec5760405162461bcd60e51b815260040161040b90614f71565b5f6120048760200151856127be90919063ffffffff16565b90505f84600401826002811061201c5761201c614f49565b600802016003019050805f015488604001511161204b5760405162461bcd60e51b815260040161040b90614f9f565b604088015181556060880151602090810151015160018083019190915560c0890151600483015561207c908a614fed565b87036120c757857fd0793cc4198bf052a6d91a9a1273c4af39f02a91b0e19029477511c278c5b2716120ad8761403b565b6040516120ba9190615263565b60405180910390a261217a565b6120d260018a614fed565b8710156121725789516120ea906107ae896001615000565b80519098508611156121395760405162461bcd60e51b81526020600482015260186024820152774e6f6e2d617363656e64696e67206368616e6e656c49647360401b604482015260640161040b565b875186101561216d57857fd0793cc4198bf052a6d91a9a1273c4af39f02a91b0e19029477511c278c5b2716120ad8761403b565b61217a565b61217a614fc5565b505060019094019350611f1c92505050565b5f81815260068301602052604090206001600382015460ff1660048111156121b6576121b6614f5d565b146121d35760405162461bcd60e51b815260040161040b906150d4565b60158101546001600160a01b031661222d5760405162461bcd60e51b815260206004820152601a60248201527f4e6f2070656e64696e6720776974686472617720696e74656e74000000000000604482015260640161040b565b61223781336126c3565b61227c5760405162461bcd60e51b815260206004820152601660248201527536b9b39739b2b73232b91034b9903737ba103832b2b960511b604482015260640161040b565b6015810180546001600160a01b03191690555f60168201819055601782018190556018820181905560405183917f9a8a5493b616f074b3f754b5fd66049c8e7980f01547289e5e31808485c6002c91a2505050565b5f84815260068601602052604090206002600382015460ff1660048111156122fb576122fb614f5d565b146123185760405162461bcd60e51b815260040161040b906150d4565b5f61232382866127be565b90505f8484604051612336929190615285565b604051809103902090505f83600401836002811061235657612356614f49565b600802016003019050818160020154146123a75760405162461bcd60e51b8152602060048201526012602482015271098d2e6e840d0c2e6d040dad2e6dac2e8c6d60731b604482015260640161040b565b5f6123e687878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061406392505050565b6020810151600284015590506116318a8a8684612837565b60408051602080820183526060825282518084019093525f80845290830184905290919061242d8260016141e5565b90508060018151811061244257612442614f49565b60200260200101516001600160401b0381111561246157612461615102565b6040519080825280602002602001820160405280156124a657816020015b604080518082019091526060808252602082015281526020019060019003908161247f5790505b50835280515f90829060019081106124c0576124c0614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576124e68461429d565b90925090508160010361256e576125046124ff856142d5565b61438c565b855f01518460018151811061251b5761251b614f49565b60200260200101518151811061253357612533614f49565b60200260200101819052508260018151811061255157612551614f49565b60200260200101805180919061256690615294565b9052506124cf565b612578848261451d565b6124cf565b50505050919050565b61258e614cb3565b604080518082019091525f80825260208201849052805b602083015151835110156126bb576125bc8361429d565b9092509050816001036125e1576125da6125d5846142d5565b614592565b84526125a5565b8160020361260d576125fa6125f5846142d5565b6145a8565b6001600160a01b031660208501526125a5565b816003036126285761261e836145b2565b60408501526125a5565b8160040361264b5761264161263c846142d5565b614621565b60608501526125a5565b8160050361266e5761266461265f846142d5565b614063565b60808501526125a5565b816006036126895761267f836145b2565b60a08501526125a5565b816007036126ac576126a261269d846142d5565b6146a9565b60c08501526125a5565b6126b6838261451d565b6125a5565b505050919050565b60048201545f906001600160a01b03838116911614806126f25750600c8301546001600160a01b038381169116145b9392505050565b5f815160021461270a57505f6126f2565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c849052603c812090805b60028110156127b15761277085828151811061275957612759614f49565b6020026020010151846146de90919063ffffffff16565b915086600401816002811061278757612787614f49565b60080201546001600160a01b038381169116146127a9575f93505050506126f2565b60010161273b565b5060019695505050505050565b60048201545f906001600160a01b03908116908316036127df57505f610fc3565b600c8301546001600160a01b03908116908316036127ff57506001610fc3565b60405162461bcd60e51b815260206004820152600d60248201526c2737b732bc34b9ba103832b2b960991b604482015260640161040b565b5f838152600685016020526040812060028087015484519293926001600160a01b0390911691637cac39cf919060048601908890811061287957612879614f49565b60080201600301600301546040518363ffffffff1660e01b81526004016128a19291906152ac565b5f60405180830381865afa1580156128bb573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526128e291908101906152f8565b90505f805b82518110156129b45782818151811061290257612902614f49565b6020026020010151826129159190615000565b915083600401866002811061292c5761292c614f49565b6008020154855180516001600160a01b03909216918390811061295157612951614f49565b6020026020010151887f33252d4bc5cee2ad248475e8c39239a79dc64b2691c9ca1a63ff9af0c75b877686858151811061298d5761298d614f49565b60200260200101516040516129a491815260200190565b60405180910390a46001016128e7565b50808360040186600281106129cb576129cb614f49565b60080201600301600101546129e09190615000565b8360040186600281106129f5576129f5614f49565b60080201600401556020840151612a2f575f836004018660028110612a1c57612a1c614f49565b6008020160030160040181905550610838565b80836004018660028110612a4557612a45614f49565b6008020160030160040154612a5a9190614fed565b836004018660028110612a6f57612a6f614f49565b600802016003016004018190555050505050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c839052603c81208190612ac090846146de565b9050612acc85826126c3565b95945050505050565b5f81815260068301602052604090206001810154612af39042615000565b8155612b0183826002612f77565b817f296143e7e25aa055fbb871702776a67da540876e2be721d5c38ba23c97c90d64612b2c8361403b565b604051612b399190615263565b60405180910390a2505050565b60408051808201909152606080825260208201525f612b7783604080518082019091525f8152602081019190915290565b90505f612b858260026141e5565b905080600281518110612b9a57612b9a614f49565b60200260200101516001600160401b03811115612bb957612bb9615102565b604051908082528060200260200182016040528015612bec57816020015b6060815260200190600190039081612bd75790505b5083602001819052505f81600281518110612c0957612c09614f49565b6020026020010181815250505f5f5b6020840151518451101561257d57612c2f8461429d565b909250905081600103612c4c57612c45846142d5565b8552612c18565b81600203612cc857612c5d846142d5565b856020015184600281518110612c7557612c75614f49565b602002602001015181518110612c8d57612c8d614f49565b602002602001018190525082600281518110612cab57612cab614f49565b602002602001018051809190612cc090615294565b905250612c18565b612cd2848261451d565b612c18565b612d1e6040805161010081019091525f60c0820181815260e083019190915260808201908152606060a0830152819081526020015f81526020015f81526020015f81525090565b604080518082019091525f80825260208201849052805b602083015151835110156126bb57612d4c8361429d565b909250905081600103612d7157612d6a612d65846142d5565b614706565b8452612d35565b81600203612d8c57612d82836145b2565b6020850152612d35565b81600303612da757612d9d836145b2565b6040850152612d35565b81600403612dc257612db8836145b2565b6060850152612d35565b612dcc838261451d565b612d35565b6040805160028082526060820183525f92839283929091602083019080368337505086518251929350918391505f90612e0c57612e0c614f49565b6001600160a01b0392909216602092830291909101820152850151815182906001908110612e3c57612e3c614f49565b6001600160a01b039283166020918202929092010152604051630d63a1fd60e01b81525f91881690630d63a1fd90612e7c90859030908a906004016153a2565b6020604051808303815f875af1158015612e98573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612ebc919061524c565b905080612efe5760405162461bcd60e51b815260206004820152601060248201526f06368616e6e656c4964206765747320360841b604482015260640161040b565b5f818152600689016020526040812090600382015460ff166004811115612f2757612f27614f5d565b14612f695760405162461bcd60e51b815260206004820152601260248201527113d8d8dd5c1a59590818da185b9b995b125960721b604482015260640161040b565b909890975095505050505050565b806004811115612f8957612f89614f5d565b600383015460ff166004811115612fa257612fa2614f5d565b03612fac57505050565b5f600383015460ff166004811115612fc657612fc6614f5d565b1461303157600382015460019084905f9060ff166004811115612feb57612feb614f5d565b81526020019081526020015f20546130039190614fed565b600383015484905f9060ff16600481111561302057613020614f5d565b815260208101919091526040015f20555b825f82600481111561304557613045614f5d565b81526020019081526020015f2054600161305f9190615000565b835f83600481111561307357613073614f5d565b815260208101919091526040015f205560038201805482919060ff191660018360048111156130a4576130a4614f5d565b0217905550505050565b604080518082019091525f80825260208201526001825160028111156130d6576130d6614f5d565b036130f65760208201516001600160a01b0316156130f2575f5ffd5b5090565b60028251600281111561310b5761310b614f5d565b0361313f5760208201516001600160a01b0316613126575f5ffd5b5f82602001516001600160a01b03163b116130f2575f5ffd5b6130f2614fc5565b6040516001600160a01b0384811660248301528381166044830152606482018390526131ae9186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b0383818316178352505050506148b3565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052613205848261491f565b6131ae576040516001600160a01b0384811660248301525f604483015261323991869182169063095ea7b39060640161317c565b6131ae84826148b3565b60408051808201909152606080825260208201525f61327483604080518082019091525f8152602081019190915290565b90505f6132828260026141e5565b90508060028151811061329757613297614f49565b60200260200101516001600160401b038111156132b6576132b6615102565b6040519080825280602002602001820160405280156132e957816020015b60608152602001906001900390816132d45790505b5083602001819052505f8160028151811061330657613306614f49565b6020026020010181815250505f5f5b6020840151518451101561257d5761332c8461429d565b90925090508160010361334957613342846142d5565b8552613315565b816002036133c55761335a846142d5565b85602001518460028151811061337257613372614f49565b60200260200101518151811061338a5761338a614f49565b6020026020010181905250826002815181106133a8576133a8614f49565b6020026020010180518091906133bd90615294565b905250613315565b6133cf848261451d565b613315565b6133dc614d14565b604080518082019091525f80825260208201849052805b602083015151835110156126bb5761340a8361429d565b90925090508160010361342a576134236125d5846142d5565b84526133f3565b816002036134455761343b836145b2565b60208501526133f3565b816003036134685761345e613459846142d5565b614968565b60408501526133f3565b8160040361348357613479836145b2565b60608501526133f3565b816005036134a1576134976125d5846142d5565b60808501526133f3565b6134ab838261451d565b6133f3565b5f6134bb84846127be565b9050818460040182600281106134d3576134d3614f49565b60080201600201546134e59190615000565b8460040182600281106134fa576134fa614f49565b600802016002018190555050505050565b81156136fa575f8481526006860160205260409020816135a5576003860154600282015460405163470660bb60e11b8152600481018890526001600160a01b0361010090920482166024820152868216604482015260648101869052911690638e0cc176906084015f604051808303815f87803b15801561358a575f5ffd5b505af115801561359c573d5f5f3e3d5ffd5b50505050611eb6565b5f828152600687016020526040902060028082015460ff16908111156135cd576135cd614f5d565b60028084015460ff16908111156135e6576135e6614f5d565b148015613611575060028181015490830154610100918290046001600160a01b039081169290910416145b6136695760405162461bcd60e51b815260206004820152602360248201527f546f6b656e206d69736d61746368206f6620726563697069656e74206368616e6044820152621b995b60ea1b606482015260840161040b565b61367587848787613de1565b6003870154600283015460405163405d4a9760e11b815260048101899052602481018690526001600160a01b03610100909204821660448201528782166064820152608481018790529116906380ba952e9060a4015f604051808303815f87803b1580156136e1575f5ffd5b505af11580156136f3573d5f5f3e3d5ffd5b5050505050505b5050505050565b60408051808201909152606080825260208201525f61373283604080518082019091525f8152602081019190915290565b90505f6137408260026141e5565b90508060028151811061375557613755614f49565b60200260200101516001600160401b0381111561377457613774615102565b6040519080825280602002602001820160405280156137a757816020015b60608152602001906001900390816137925790505b5083602001819052505f816002815181106137c4576137c4614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576137ea8461429d565b90925090508160010361380757613800846142d5565b85526137d3565b8160020361388357613818846142d5565b85602001518460028151811061383057613830614f49565b60200260200101518151811061384857613848614f49565b60200260200101819052508260028151811061386657613866614f49565b60200260200101805180919061387b90615294565b9052506137d3565b61388d848261451d565b6137d3565b6138ba60405180608001604052805f81526020015f8152602001606081526020015f81525090565b604080518082019091525f808252602082018490526138da8260046141e5565b9050806003815181106138ef576138ef614f49565b60200260200101516001600160401b0381111561390e5761390e615102565b60405190808252806020026020018201604052801561395257816020015b604080518082019091525f808252602082015281526020019060019003908161392c5790505b5083604001819052505f8160038151811061396f5761396f614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576139958461429d565b9092509050816001036139b5576139ae6125d5856142d5565b855261397e565b816002036139d0576139c6846145b2565b602086015261397e565b81600303613a4f576139e4613459856142d5565b8560400151846003815181106139fc576139fc614f49565b602002602001015181518110613a1457613a14614f49565b602002602001018190525082600381518110613a3257613a32614f49565b602002602001018051809190613a4790615294565b90525061397e565b81600403613a6a57613a60846145b2565b606086015261397e565b613a74848261451d565b61397e565b5f5b6002811015611eb657818160028110613a9657613a96614f49565b602002015115613b4c5760038601546001600160a01b0316638e0cc1768686868560028110613ac757613ac7614f49565b6020020151868660028110613ade57613ade614f49565b60200201516040516001600160e01b031960e087901b16815260048101949094526001600160a01b0392831660248501529116604483015260648201526084015f604051808303815f87803b158015613b35575f5ffd5b505af1158015613b47573d5f5f3e3d5ffd5b505050505b600101613a7b565b5f613b5d614d44565b604080518082019091525f9060048501600283835b82821015613c0257604080516080808201835260088502870180546001600160a01b03168352600180820154602080860191909152600283015485870152855160a081018752600384015481526004840154818301526005840154968101969096526006830154606087810191909152600790930154938601939093529083019390935290835292019101613b72565b5050505090505f604051806040016040528083600160028110613c2757613c27614f49565b60200201516060015160200151845f60028110613c4657613c46614f49565b602002015160200151613c599190615000565b8152835160600151602090810151818601518201519190920191613c7c91615000565b905290505f5b6002811015613d55575f838260028110613c9e57613c9e614f49565b602002015160400151848360028110613cb957613cb9614f49565b60200201516060015160200151613cd09190615000565b905080838360028110613ce557613ce5614f49565b60200201511015613d13575f60405180604001604052805f81526020015f8152509550955050505050915091565b80838360028110613d2657613d26614f49565b6020020151613d359190614fed565b838360028110613d4757613d47614f49565b602002015250600101613c82565b5060019590945092505050565b5f8155613d7182826001612f77565b5f600782018190556008820181905560098201819055600a8201819055600b8201819055600f8201819055601082018190556011820181905560128201819055601382018190556015820180546001600160a01b0319169055601682018190556017820181905560189091015550565b5f83815260068501602052604090206001600382015460ff166004811115613e0b57613e0b614f5d565b14613e285760405162461bcd60e51b815260040161040b906150d4565b5f613e3382856127be565b600587015490915060ff1615613f2957600282015461010090046001600160a01b03165f9081526004878101602052604091829020549151636b5c4f1d60e11b815290810184905273__$13d4168a6482a4756bee5acfadcccc5f1f$__9063d6b89e3a90602401602060405180830381865af4158015613eb5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613ed9919061524c565b613ee39085615000565b1115613f295760405162461bcd60e51b815260206004820152601560248201527410985b185b98d948195e18d959591cc81b1a5b5a5d605a1b604482015260640161040b565b82826004018260028110613f3f57613f3f614f49565b6008020160010154613f519190615000565b826004018260028110613f6657613f66614f49565b60080201600101819055505f5f5f8473__$13d4168a6482a4756bee5acfadcccc5f1f$__63c8ed149e90916040518263ffffffff1660e01b8152600401613faf91815260200190565b60c060405180830381865af4158015613fca573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613fee9190615195565b925092509250877fb63f5dc096f516663ffb5ef2b611f0e2acca8617a868c2a3653cba5e3ed0e92c84848460405161402893929190615402565b60405180910390a2505050505050505050565b614043614d44565b506040805180820190915260078201548152600f90910154602082015290565b604080518082018252606081525f6020808301829052835180850190945281845283018490529091906140978260026141e5565b9050806001815181106140ac576140ac614f49565b60200260200101516001600160401b038111156140cb576140cb615102565b6040519080825280602002602001820160405280156140f4578160200160208202803683370190505b50835280515f908290600190811061410e5761410e614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576141348461429d565b9092509050816001036141b85761414d6125d5856142d5565b855f01518460018151811061416457614164614f49565b60200260200101518151811061417c5761417c614f49565b6020026020010181815250508260018151811061419b5761419b614f49565b6020026020010180518091906141b090615294565b90525061411d565b816002036141d6576141cc6125d5856142d5565b602086015261411d565b6141e0848261451d565b61411d565b81516060906141f5836001615000565b6001600160401b0381111561420c5761420c615102565b604051908082528060200260200182016040528015614235578160200160208202803683370190505b5091505f5f5b60208601515186511015614294576142528661429d565b8092508193505050600184838151811061426e5761426e614f49565b602002602001018181516142829190615000565b90525061428f868261451d565b61423b565b50509092525090565b5f5f5f6142a9846145b2565b90506142b660088261542a565b92508060071660058111156142cd576142cd614f5d565b915050915091565b60605f6142e1836145b2565b90505f81845f01516142f39190615000565b9050836020015151811115614306575f5ffd5b816001600160401b0381111561431e5761431e615102565b6040519080825280601f01601f191660200182016040528015614348576020820181803683370190505b5060208086015186519295509181860191908301015f5b8581101561438157818101518382015261437a602082615000565b905061435f565b505050935250919050565b60408051808201909152606080825260208201525f6143bd83604080518082019091525f8152602081019190915290565b90505f6143cb8260026141e5565b9050806002815181106143e0576143e0614f49565b60200260200101516001600160401b038111156143ff576143ff615102565b60405190808252806020026020018201604052801561443257816020015b606081526020019060019003908161441d5790505b5083602001819052505f8160028151811061444f5761444f614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576144758461429d565b9092509050816001036144925761448b846142d5565b855261445e565b8160020361450e576144a3846142d5565b8560200151846002815181106144bb576144bb614f49565b6020026020010151815181106144d3576144d3614f49565b6020026020010181905250826002815181106144f1576144f1614f49565b60200260200101805180919061450690615294565b90525061445e565b614518848261451d565b61445e565b5f81600581111561453057614530614f5d565b036145435761453e826145b2565b505050565b600281600581111561455757614557614f5d565b036100fb575f614566836145b2565b905080835f018181516145799190615000565b9052506020830151518351111561453e575f5ffd5b5050565b5f81516020146145a0575f5ffd5b506020015190565b5f610fc3826149ff565b60208082015182518101909101515f9182805b600a8110156100fb5783811a91506145de816007615449565b82607f16901b85179450816080165f03614619576145fd816001615000565b8651879061460c908390615000565b9052509395945050505050565b6001016145c5565b614629614d62565b604080518082019091525f80825260208201849052805b602083015151835110156126bb576146578361429d565b90925090508160010361467c57614675614670846142d5565b614a1c565b8452614640565b8160020361469a57614690613459846142d5565b6020850152614640565b6146a4838261451d565b614640565b5f6020825111156146b8575f5ffd5b60208201519050815160206146cd9190614fed565b6146d8906008615449565b1c919050565b5f5f5f5f6146ec8686614aea565b9250925092506146fc8282614b33565b5090949350505050565b604080516080810182525f91810182815260608083019390935281526020810191909152604080518082019091525f8082526020820184905261474a8260026141e5565b90508060028151811061475f5761475f614f49565b60200260200101516001600160401b0381111561477e5761477e615102565b6040519080825280602002602001820160405280156147c257816020015b604080518082019091525f808252602082015281526020019060019003908161479c5790505b5083602001819052505f816002815181106147df576147df614f49565b6020026020010181815250505f5f5b6020840151518451101561257d576148058461429d565b9092509050816001036148255761481e614670856142d5565b85526147ee565b816002036148a457614839613459856142d5565b85602001518460028151811061485157614851614f49565b60200260200101518151811061486957614869614f49565b60200260200101819052508260028151811061488757614887614f49565b60200260200101805180919061489c90615294565b9052506147ee565b6148ae848261451d565b6147ee565b5f5f60205f8451602086015f885af1806148d2576040513d5f823e3d81fd5b50505f513d915081156148e95780600114156148f6565b6001600160a01b0384163b155b156131ae57604051635274afe760e01b81526001600160a01b038516600482015260240161040b565b5f5f5f5f60205f8651602088015f8a5af192503d91505f51905082801561495e57508115614950578060011461495e565b5f866001600160a01b03163b115b9695505050505050565b6040805180820182525f808252602080830182905283518085019094528184528301849052909190805b602083015151835110156126bb576149a98361429d565b9092509050816001036149d2576149c26125f5846142d5565b6001600160a01b03168452614992565b816002036149f0576149e661269d846142d5565b6020850152614992565b6149fa838261451d565b614992565b5f8151601414614a0d575f5ffd5b5060200151600160601b900490565b604080518082019091525f8082526020820152604080518082019091525f80825260208201849052505f5f5b602083015151835110156126bb57614a5f8361429d565b909250905081600103614ab457614a75836145b2565b6002811115614a8657614a86614f5d565b84906002811115614a9957614a99614f5d565b90816002811115614aac57614aac614f5d565b905250614a48565b81600203614adb57614ac86125f5846142d5565b6001600160a01b03166020850152614a48565b614ae5838261451d565b614a48565b5f5f5f8351604103614b21576020840151604085015160608601515f1a614b1388828585614beb565b955095509550505050614b2c565b505081515f91506002905b9250925092565b5f826003811115614b4657614b46614f5d565b03614b4f575050565b6001826003811115614b6357614b63614f5d565b03614b815760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115614b9557614b95614f5d565b03614bb65760405163fce698f760e01b81526004810182905260240161040b565b6003826003811115614bca57614bca614f5d565b0361458e576040516335e2f38360e21b81526004810182905260240161040b565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115614c2457505f91506003905082614ca9565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015614c75573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116614ca057505f925060019150829050614ca9565b92505f91508190505b9450945094915050565b6040518060e001604052805f81526020015f6001600160a01b031681526020015f8152602001614ce1614d62565b8152602001614d026040518060400160405280606081526020015f81525090565b81526020015f81526020015f81525090565b6040518060a001604052805f81526020015f8152602001614d02604080518082019091525f808252602082015290565b60405180604001604052806002906020820280368337509192915050565b604080516080810182525f91810182815260608201929092529081908152602001614d9c604080518082019091525f808252602082015290565b905290565b5f5f83601f840112614db1575f5ffd5b5081356001600160401b03811115614dc7575f5ffd5b602083019150836020828501011115614dde575f5ffd5b9250929050565b5f5f5f60408486031215614df7575f5ffd5b8335925060208401356001600160401b03811115614e13575f5ffd5b614e1f86828701614da1565b9497909650939450505050565b5f60208284031215614e3c575f5ffd5b5035919050565b5f5f60408385031215614e54575f5ffd5b50508035926020909101359150565b5f5f5f5f60808587031215614e76575f5ffd5b5050823594602084013594506040840135936060013592509050565b6001600160a01b0381168114614ea6575f5ffd5b50565b5f5f5f5f60808587031215614ebc575f5ffd5b84359350602085013592506040850135614ed581614e92565b9396929550929360600135925050565b5f5f5f5f5f60808688031215614ef9575f5ffd5b85359450602086013593506040860135614f1281614e92565b925060608601356001600160401b03811115614f2c575f5ffd5b614f3888828901614da1565b969995985093965092949392505050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b60208082526014908201527310da1958dac818dbcb5cda59dcc819985a5b195960621b604082015260600190565b6020808252600c908201526b39b2b8a73ab69032b93937b960a11b604082015260600190565b634e487b7160e01b5f52600160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b81810381811115610fc357610fc3614fd9565b80820180821115610fc357610fc3614fd9565b805f5b60028110156131ae5781516001600160a01b0316845260209384019390910190600101615016565b805f5b60028110156131ae578151845260209384019390910190600101615041565b83815260a081016150746020830185615013565b615081606083018461503e565b949350505050565b60208082526012908201527106d73672e76616c7565206973206e6f7420360741b604082015260600190565b5f602082840312156150c5575f5ffd5b815180151581146126f2575f5ffd5b60208082526014908201527321b430b73732b61039ba30ba3ab99032b93937b960611b604082015260600190565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561513e5761513e615102565b604052919050565b5f82601f830112615155575f5ffd5b61515f6040615116565b806040840185811115615170575f5ffd5b845b8181101561518a578051845260209384019301615172565b509095945050505050565b5f5f5f60c084860312156151a7575f5ffd5b84601f8501126151b5575f5ffd5b6151bf6040615116565b8060408601878111156151d0575f5ffd5b865b818110156151f35780516151e581614e92565b8452602093840193016151d2565b508195506152018882615146565b94505050506152138560808601615146565b90509250925092565b84815260c08101615230602083018661503e565b61523d606083018561503e565b8260a083015295945050505050565b5f6020828403121561525c575f5ffd5b5051919050565b60408101610fc3828461503e565b83815260a08101615074602083018561503e565b818382375f9101908152919050565b5f600182016152a5576152a5614fd9565b5060010190565b604080825283519082018190525f9060208501906060840190835b818110156152e55783518352602093840193909201916001016152c7565b5050602093909301939093525092915050565b5f60208284031215615308575f5ffd5b81516001600160401b0381111561531d575f5ffd5b8201601f8101841361532d575f5ffd5b80516001600160401b0381111561534657615346615102565b8060051b61535660208201615116565b91825260208184018101929081019087841115615371575f5ffd5b6020850194505b8385101561539757845180835260209586019590935090910190615378565b979650505050505050565b606080825284519082018190525f9060208601906080840190835b818110156153e45783516001600160a01b03168352602093840193909201916001016153bd565b50506001600160a01b03959095166020840152505060400152919050565b60c081016154108286615013565b61541d604083018561503e565b615081608083018461503e565b5f8261544457634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610fc357610fc3614fd956fea264697066735822122025fe890aa91809ae3d2872de514230b2e0615a535cb65885313b12f10654134e64736f6c634300081e0033", } // LedgerOperationABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/payregistry/payregistry.go b/chain/channel-eth-go/payregistry/payregistry.go index ed34d45..7b88cca 100644 --- a/chain/channel-eth-go/payregistry/payregistry.go +++ b/chain/channel-eth-go/payregistry/payregistry.go @@ -32,7 +32,7 @@ var ( // PayRegistryMetaData contains all meta data concerning the PayRegistry contract. var PayRegistryMetaData = &bind.MetaData{ ABI: "[{\"type\":\"function\",\"name\":\"calculatePayId\",\"inputs\":[{\"name\":\"_payHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_setter\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getPayAmounts\",\"inputs\":[{\"name\":\"_payIds\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_lastPayResolveDeadline\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPayInfo\",\"inputs\":[{\"name\":\"_payId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"payInfoMap\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"resolveDeadline\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setPayAmount\",\"inputs\":[{\"name\":\"_payHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_amt\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayAmounts\",\"inputs\":[{\"name\":\"_payHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_amts\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayDeadline\",\"inputs\":[{\"name\":\"_payHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_deadline\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayDeadlines\",\"inputs\":[{\"name\":\"_payHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_deadlines\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayInfo\",\"inputs\":[{\"name\":\"_payHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_amt\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_deadline\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayInfos\",\"inputs\":[{\"name\":\"_payHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_amts\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"_deadlines\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"PayInfoUpdate\",\"inputs\":[{\"name\":\"payId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"resolveDeadline\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false}]", - Bin: "0x6080604052348015600e575f5ffd5b50610a668061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009b575f3560e01c80638f13b2f5116100635780638f13b2f51461013b57806396efe57314610161578063cdfa146b14610182578063e1e3549014610195578063f8fb012f146101a8575f5ffd5b80630daddd341461009f578063204a95ee146100b457806327b0e058146100c7578063414f7e0e146101085780637cac39cf1461011b575b5f5ffd5b6100b26100ad36600461078c565b6101bb565b005b6100b26100c236600461078c565b61029e565b6100ee6100d53660046107f8565b5f90815260208190526040902080546001909101549091565b604080519283526020830191909152015b60405180910390f35b6100b261011636600461080f565b610360565b61012e6101293660046108ae565b61046c565b6040516100ff91906108f6565b6100ee6101493660046107f8565b5f602081905290815260409020805460019091015482565b61017461016f366004610938565b61060d565b6040519081526020016100ff565b6100b2610190366004610971565b61065a565b6100b26101a3366004610991565b6106ac565b6100b26101b6366004610971565b6106ff565b8281146101e35760405162461bcd60e51b81526004016101da906109ba565b60405180910390fd5b5f33815b8581101561029557610211878783818110610204576102046109e8565b905060200201358361060d565b5f818152602081905260409020909350858583818110610233576102336109e8565b6020029190910135600183015550805484905f516020610a115f395f51905f5290888886818110610266576102666109e8565b90506020020135604051610284929190918252602082015260400190565b60405180910390a2506001016101e7565b50505050505050565b8281146102bd5760405162461bcd60e51b81526004016101da906109ba565b5f33815b85811015610295576102de878783818110610204576102046109e8565b5f818152602081905260409020909350858583818110610300576103006109e8565b6020029190910135825550835f516020610a115f395f51905f5287878581811061032c5761032c6109e8565b90506020020135836001015460405161034f929190918252602082015260400190565b60405180910390a2506001016102c1565b848314801561036e57508481145b61038a5760405162461bcd60e51b81526004016101da906109ba565b5f33815b87811015610461576103ab898983818110610204576102046109e8565b5f8181526020819052604090209093508787838181106103cd576103cd6109e8565b60200291909101358255508585838181106103ea576103ea6109e8565b6020029190910135600183015550835f516020610a115f395f51905f52898985818110610419576104196109e8565b90506020020135888886818110610432576104326109e8565b90506020020135604051610450929190918252602082015260400190565b60405180910390a25060010161038e565b505050505050505050565b60605f8367ffffffffffffffff811115610488576104886109fc565b6040519080825280602002602001820160405280156104b1578160200160208202803683370190505b5090505f5b84811015610604575f5f8787848181106104d2576104d26109e8565b9050602002013581526020019081526020015f20600101545f0361053f5783431161053a5760405162461bcd60e51b815260206004820152601860248201527714185e5b595b9d081a5cc81b9bdd08199a5b985b1a5e995960421b60448201526064016101da565b6105b4565b5f5f878784818110610553576105536109e8565b9050602002013581526020019081526020015f206001015443116105b45760405162461bcd60e51b815260206004820152601860248201527714185e5b595b9d081a5cc81b9bdd08199a5b985b1a5e995960421b60448201526064016101da565b5f5f8787848181106105c8576105c86109e8565b9050602002013581526020019081526020015f205f01548282815181106105f1576105f16109e8565b60209081029190910101526001016104b6565b50949350505050565b5f828260405160200161063c92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b5f610665833361060d565b5f8181526020818152604091829020600181018690558054835190815291820186905292935083915f516020610a115f395f51905f5291015b60405180910390a250505050565b5f6106b7843361060d565b5f818152602081815260409182902086815560018101869055825187815291820186905292935083915f516020610a115f395f51905f52910160405180910390a25050505050565b5f61070a833361060d565b5f8181526020818152604091829020858155600181015483518781529283015292935083915f516020610a115f395f51905f52910161069e565b5f5f83601f840112610754575f5ffd5b50813567ffffffffffffffff81111561076b575f5ffd5b6020830191508360208260051b8501011115610785575f5ffd5b9250929050565b5f5f5f5f6040858703121561079f575f5ffd5b843567ffffffffffffffff8111156107b5575f5ffd5b6107c187828801610744565b909550935050602085013567ffffffffffffffff8111156107e0575f5ffd5b6107ec87828801610744565b95989497509550505050565b5f60208284031215610808575f5ffd5b5035919050565b5f5f5f5f5f5f60608789031215610824575f5ffd5b863567ffffffffffffffff81111561083a575f5ffd5b61084689828a01610744565b909750955050602087013567ffffffffffffffff811115610865575f5ffd5b61087189828a01610744565b909550935050604087013567ffffffffffffffff811115610890575f5ffd5b61089c89828a01610744565b979a9699509497509295939492505050565b5f5f5f604084860312156108c0575f5ffd5b833567ffffffffffffffff8111156108d6575f5ffd5b6108e286828701610744565b909790965060209590950135949350505050565b602080825282518282018190525f918401906040840190835b8181101561092d57835183526020938401939092019160010161090f565b509095945050505050565b5f5f60408385031215610949575f5ffd5b8235915060208301356001600160a01b0381168114610966575f5ffd5b809150509250929050565b5f5f60408385031215610982575f5ffd5b50508035926020909101359150565b5f5f5f606084860312156109a3575f5ffd5b505081359360208301359350604090920135919050565b602080825260149082015273098cadccee8d0e640c8de40dcdee840dac2e8c6d60631b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffdfe9e9acc6d43d5d7bd6fa143ef0ee1d224cfe2bb010b7e3acf44878d6314ebc607a264697066735822122046b17ef2ec99a6ea7ec246eae9d2610fffc689044235dd5d2b95a081f594bb7f64736f6c634300081e0033", + Bin: "0x6080604052348015600e575f5ffd5b50610a668061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061009b575f3560e01c80638f13b2f5116100635780638f13b2f51461013b57806396efe57314610161578063cdfa146b14610182578063e1e3549014610195578063f8fb012f146101a8575f5ffd5b80630daddd341461009f578063204a95ee146100b457806327b0e058146100c7578063414f7e0e146101085780637cac39cf1461011b575b5f5ffd5b6100b26100ad36600461078c565b6101bb565b005b6100b26100c236600461078c565b61029e565b6100ee6100d53660046107f8565b5f90815260208190526040902080546001909101549091565b604080519283526020830191909152015b60405180910390f35b6100b261011636600461080f565b610360565b61012e6101293660046108ae565b61046c565b6040516100ff91906108f6565b6100ee6101493660046107f8565b5f602081905290815260409020805460019091015482565b61017461016f366004610938565b61060d565b6040519081526020016100ff565b6100b2610190366004610971565b61065a565b6100b26101a3366004610991565b6106ac565b6100b26101b6366004610971565b6106ff565b8281146101e35760405162461bcd60e51b81526004016101da906109ba565b60405180910390fd5b5f33815b8581101561029557610211878783818110610204576102046109e8565b905060200201358361060d565b5f818152602081905260409020909350858583818110610233576102336109e8565b6020029190910135600183015550805484905f516020610a115f395f51905f5290888886818110610266576102666109e8565b90506020020135604051610284929190918252602082015260400190565b60405180910390a2506001016101e7565b50505050505050565b8281146102bd5760405162461bcd60e51b81526004016101da906109ba565b5f33815b85811015610295576102de878783818110610204576102046109e8565b5f818152602081905260409020909350858583818110610300576103006109e8565b6020029190910135825550835f516020610a115f395f51905f5287878581811061032c5761032c6109e8565b90506020020135836001015460405161034f929190918252602082015260400190565b60405180910390a2506001016102c1565b848314801561036e57508481145b61038a5760405162461bcd60e51b81526004016101da906109ba565b5f33815b87811015610461576103ab898983818110610204576102046109e8565b5f8181526020819052604090209093508787838181106103cd576103cd6109e8565b60200291909101358255508585838181106103ea576103ea6109e8565b6020029190910135600183015550835f516020610a115f395f51905f52898985818110610419576104196109e8565b90506020020135888886818110610432576104326109e8565b90506020020135604051610450929190918252602082015260400190565b60405180910390a25060010161038e565b505050505050505050565b60605f8367ffffffffffffffff811115610488576104886109fc565b6040519080825280602002602001820160405280156104b1578160200160208202803683370190505b5090505f5b84811015610604575f5f8787848181106104d2576104d26109e8565b9050602002013581526020019081526020015f20600101545f0361053f5783421161053a5760405162461bcd60e51b815260206004820152601860248201527714185e5b595b9d081a5cc81b9bdd08199a5b985b1a5e995960421b60448201526064016101da565b6105b4565b5f5f878784818110610553576105536109e8565b9050602002013581526020019081526020015f206001015442116105b45760405162461bcd60e51b815260206004820152601860248201527714185e5b595b9d081a5cc81b9bdd08199a5b985b1a5e995960421b60448201526064016101da565b5f5f8787848181106105c8576105c86109e8565b9050602002013581526020019081526020015f205f01548282815181106105f1576105f16109e8565b60209081029190910101526001016104b6565b50949350505050565b5f828260405160200161063c92919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b5f610665833361060d565b5f8181526020818152604091829020600181018690558054835190815291820186905292935083915f516020610a115f395f51905f5291015b60405180910390a250505050565b5f6106b7843361060d565b5f818152602081815260409182902086815560018101869055825187815291820186905292935083915f516020610a115f395f51905f52910160405180910390a25050505050565b5f61070a833361060d565b5f8181526020818152604091829020858155600181015483518781529283015292935083915f516020610a115f395f51905f52910161069e565b5f5f83601f840112610754575f5ffd5b50813567ffffffffffffffff81111561076b575f5ffd5b6020830191508360208260051b8501011115610785575f5ffd5b9250929050565b5f5f5f5f6040858703121561079f575f5ffd5b843567ffffffffffffffff8111156107b5575f5ffd5b6107c187828801610744565b909550935050602085013567ffffffffffffffff8111156107e0575f5ffd5b6107ec87828801610744565b95989497509550505050565b5f60208284031215610808575f5ffd5b5035919050565b5f5f5f5f5f5f60608789031215610824575f5ffd5b863567ffffffffffffffff81111561083a575f5ffd5b61084689828a01610744565b909750955050602087013567ffffffffffffffff811115610865575f5ffd5b61087189828a01610744565b909550935050604087013567ffffffffffffffff811115610890575f5ffd5b61089c89828a01610744565b979a9699509497509295939492505050565b5f5f5f604084860312156108c0575f5ffd5b833567ffffffffffffffff8111156108d6575f5ffd5b6108e286828701610744565b909790965060209590950135949350505050565b602080825282518282018190525f918401906040840190835b8181101561092d57835183526020938401939092019160010161090f565b509095945050505050565b5f5f60408385031215610949575f5ffd5b8235915060208301356001600160a01b0381168114610966575f5ffd5b809150509250929050565b5f5f60408385031215610982575f5ffd5b50508035926020909101359150565b5f5f5f606084860312156109a3575f5ffd5b505081359360208301359350604090920135919050565b602080825260149082015273098cadccee8d0e640c8de40dcdee840dac2e8c6d60631b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffdfe9e9acc6d43d5d7bd6fa143ef0ee1d224cfe2bb010b7e3acf44878d6314ebc607a2646970667358221220e3b956bfac24e126031dd0c900c519acc055b35be34a136ac0f786f56913a77764736f6c634300081e0033", } // PayRegistryABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/payresolver/payresolver.go b/chain/channel-eth-go/payresolver/payresolver.go index 10e92ba..954e036 100644 --- a/chain/channel-eth-go/payresolver/payresolver.go +++ b/chain/channel-eth-go/payresolver/payresolver.go @@ -32,7 +32,7 @@ var ( // PayResolverMetaData contains all meta data concerning the PayResolver contract. var PayResolverMetaData = &bind.MetaData{ ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_registryAddr\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_virtResolverAddr\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"payRegistry\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIPayRegistry\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"resolvePaymentByConditions\",\"inputs\":[{\"name\":\"_resolvePayRequest\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolvePaymentByVouchedResult\",\"inputs\":[{\"name\":\"_vouchedPayResult\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"virtResolver\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIVirtContractResolver\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"ResolvePayment\",\"inputs\":[{\"name\":\"payId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"resolveDeadline\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignature\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignatureLength\",\"inputs\":[{\"name\":\"length\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ECDSAInvalidSignatureS\",\"inputs\":[{\"name\":\"s\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]}]", - Bin: "0x6080604052348015600e575f5ffd5b506040516124b93803806124b9833981016040819052602b916074565b5f80546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617905560a0565b80516001600160a01b0381168114606f575f5ffd5b919050565b5f5f604083850312156084575f5ffd5b608b83605a565b9150609760208401605a565b90509250929050565b61240c806100ad5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634367e45e1461004e57806353fc513f146100635780635fff88c814610091578063ead54c1b146100a4575b5f5ffd5b61006161005c36600461217e565b6100b7565b005b5f54610075906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006161009f36600461217e565b6101a7565b600154610075906001600160a01b031681565b5f6100f683838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061037392505050565b90505f610105825f015161050e565b6080810151519091505f9081816005811115610123576101236121ec565b0361013d5761013683856020015161076a565b9150610189565b6001816005811115610151576101516121ec565b03610164576101368385602001516109ab565b61016d81610bfb565b156101815761013683856020015183610c4e565b610189612200565b8351805160209091012061019e8482856110b7565b50505050505050565b5f6101e683838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506114e692505050565b90505f6101f5825f01516115a2565b90505f610204825f015161050e565b905080608001516020015160200151602001518260200151111561026f5760405162461bcd60e51b815260206004820152601a60248201527f457863656564206d6178207472616e7366657220616d6f756e7400000000000060448201526064015b60405180910390fd5b825180516020918201207f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c91909152603c8120918501516102b7908390611633565b90505f6102d186604001518461163390919063ffffffff16565b905083602001516001600160a01b0316826001600160a01b031614801561030d575083604001516001600160a01b0316816001600160a01b0316145b61034d5760405162461bcd60e51b815260206004820152601160248201527010da1958dac81cda59dcc819985a5b1959607a1b6044820152606401610266565b845180516020918201209086015161036890869083906110b7565b505050505050505050565b60408051808201909152606080825260208201525f6103a483604080518082019091525f8152602081019190915290565b90505f6103b282600261165b565b9050806002815181106103c7576103c7612214565b602002602001015167ffffffffffffffff8111156103e7576103e7612228565b60405190808252806020026020018201604052801561041a57816020015b60608152602001906001900390816104055790505b5083602001819052505f8160028151811061043757610437612214565b6020026020010181815250505f5f5b602084015151845110156105055761045d84611714565b90925090508160010361047a576104738461174c565b8552610446565b816002036104f65761048b8461174c565b8560200151846002815181106104a3576104a3612214565b6020026020010151815181106104bb576104bb612214565b6020026020010181905250826002815181106104d9576104d9612214565b6020026020010180518091906104ee90612250565b905250610446565b6105008482611804565b610446565b50505050919050565b610516612092565b604080518082019091525f8082526020820184905261053682600861165b565b90508060048151811061054b5761054b612214565b602002602001015167ffffffffffffffff81111561056b5761056b612228565b6040519080825280602002602001820160405280156105a457816020015b6105916120f2565b8152602001906001900390816105895790505b5083606001819052505f816004815181106105c1576105c1612214565b6020026020010181815250505f5f5b60208401515184511015610505576105e784611714565b909250905081600103610604576105fd84611879565b85526105d0565b816002036106305761061d6106188561174c565b6118e8565b6001600160a01b031660208601526105d0565b81600303610657576106446106188561174c565b6001600160a01b031660408601526105d0565b816004036106db5761067061066b8561174c565b6118f2565b85606001518460048151811061068857610688612214565b6020026020010151815181106106a0576106a0612214565b6020026020010181905250826004815181106106be576106be612214565b6020026020010180518091906106d390612250565b9052506105d0565b816005036106fe576106f46106ef8561174c565b611a2a565b60808601526105d0565b816006036107195761070f84611879565b60a08601526105d0565b816007036107345761072a84611879565b60c08601526105d0565b8160080361075b576107486106188561174c565b6001600160a01b031660e08601526105d0565b6107658482611804565b6105d0565b5f8080805b85606001515181101561097e575f8660600151828151811061079357610793612214565b602002602001015190505f60028111156107af576107af6121ec565b815160028111156107c2576107c26121ec565b0361081c5780602001518685815181106107de576107de612214565b6020026020010151805190602001201461080a5760405162461bcd60e51b815260040161026690612268565b8361081481612250565b945050610975565b600181516002811115610831576108316121ec565b148061084f575060028151600281111561084d5761084d6121ec565b145b1561096d575f61085e82611ae7565b6080830151604051632f36f6a560e21b815291925082916001600160a01b0383169163bcdbda94916108939190600401612290565b602060405180830381865afa1580156108ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108d291906122c5565b6108ee5760405162461bcd60e51b8152600401610266906122e4565b60a083015160405163ea4ba8eb60e01b81526001600160a01b0383169163ea4ba8eb9161091e9190600401612290565b602060405180830381865afa158015610939573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061095d91906122c5565b61096657600194505b5050610975565b610975612200565b5060010161076f565b50801561098f575f925050506109a5565b8460800151602001516020015160200151925050505b92915050565b5f808080805b866060015151811015610bc5575f876060015182815181106109d5576109d5612214565b602002602001015190505f60028111156109f1576109f16121ec565b81516002811115610a0457610a046121ec565b03610a5e578060200151878681518110610a2057610a20612214565b60200260200101518051906020012014610a4c5760405162461bcd60e51b815260040161026690612268565b84610a5681612250565b955050610bbc565b600181516002811115610a7357610a736121ec565b1480610a915750600281516002811115610a8f57610a8f6121ec565b145b15610bb4575f610aa082611ae7565b6080830151604051632f36f6a560e21b815291925082916001600160a01b0383169163bcdbda9491610ad59190600401612290565b602060405180830381865afa158015610af0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b1491906122c5565b610b305760405162461bcd60e51b8152600401610266906122e4565b60a083015160405163ea4ba8eb60e01b8152600197506001600160a01b0383169163ea4ba8eb91610b649190600401612290565b602060405180830381865afa158015610b7f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ba391906122c5565b15610bad57600194505b5050610bbc565b610bbc612200565b506001016109b1565b50811580610bd05750805b15610bf057856080015160200151602001516020015193505050506109a5565b5f93505050506109a5565b5f6003826005811115610c1057610c106121ec565b1480610c2d57506004826005811115610c2b57610c2b6121ec565b145b806109a557506005826005811115610c4757610c476121ec565b1492915050565b5f808080805b876060015151811015611027575f88606001518281518110610c7857610c78612214565b602002602001015190505f6002811115610c9457610c946121ec565b81516002811115610ca757610ca76121ec565b03610d01578060200151888581518110610cc357610cc3612214565b60200260200101518051906020012014610cef5760405162461bcd60e51b815260040161026690612268565b83610cf981612250565b94505061101e565b600181516002811115610d1657610d166121ec565b1480610d345750600281516002811115610d3257610d326121ec565b145b15611016575f610d4382611ae7565b6080830151604051632f36f6a560e21b815291925082916001600160a01b0383169163bcdbda9491610d789190600401612290565b602060405180830381865afa158015610d93573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610db791906122c5565b610dd35760405162461bcd60e51b8152600401610266906122e4565b6003896005811115610de757610de76121ec565b03610e6c5760a083015160405163ea4ba8eb60e01b81526001600160a01b0383169163ea4ba8eb91610e1c9190600401612290565b602060405180830381865afa158015610e37573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e5b919061231b565b610e659088612332565b965061100b565b6004896005811115610e8057610e806121ec565b03610efd57610e6587826001600160a01b031663ea4ba8eb8660a001516040518263ffffffff1660e01b8152600401610eb99190612290565b602060405180830381865afa158015610ed4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef8919061231b565b611bdb565b6005896005811115610f1157610f116121ec565b03611003578415610f9457610e6587826001600160a01b031663ea4ba8eb8660a001516040518263ffffffff1660e01b8152600401610f509190612290565b602060405180830381865afa158015610f6b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f8f919061231b565b611bea565b60a083015160405163ea4ba8eb60e01b81526001600160a01b0383169163ea4ba8eb91610fc49190600401612290565b602060405180830381865afa158015610fdf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e65919061231b565b61100b612200565b60019450505061101e565b61101e612200565b50600101610c54565b50801561109957866080015160200151602001516020015183111561108e5760405162461bcd60e51b815260206004820152601a60248201527f457863656564206d6178207472616e7366657220616d6f756e740000000000006044820152606401610266565b8293505050506110b0565b866080015160200151602001516020015193505050505b9392505050565b60a083015143908111156111205760405162461bcd60e51b815260206004820152602a60248201527f50617373656420706179207265736f6c766520646561646c696e6520696e20636044820152696f6e64506179206d736760b01b6064820152608401610266565b5f61112b8430611bf9565b5f80546040516304f61c0b60e31b815260048101849052929350909182916001600160a01b0316906327b0e058906024016040805180830381865afa158015611176573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061119a9190612345565b91509150805f14806111ac5750808411155b6112045760405162461bcd60e51b815260206004820152602360248201527f506173736564206f6e636861696e207265736f6c76652070617920646561646c604482015262696e6560e81b6064820152608401610266565b80156113ae578185116112595760405162461bcd60e51b815260206004820152601860248201527f4e657720616d6f756e74206973206e6f74206c617267657200000000000000006044820152606401610266565b86608001516020015160200151602001518503611317575f54604051630e1e354960e41b81526004810188905260248101879052604481018690526001600160a01b039091169063e1e35490906064015f604051808303815f87803b1580156112c0575f5ffd5b505af11580156112d2573d5f5f3e3d5ffd5b505060408051888152602081018890528693507fa87e293885636c5018108e8ee0e41d65206d1dfc0a9066f26f2a91a78b2beb179250015b60405180910390a261019e565b5f5460405163f8fb012f60e01b815260048101889052602481018790526001600160a01b039091169063f8fb012f906044015f604051808303815f87803b158015611360575f5ffd5b505af1158015611372573d5f5f3e3d5ffd5b505060408051888152602081018590528693507fa87e293885636c5018108e8ee0e41d65206d1dfc0a9066f26f2a91a78b2beb1792500161130a565b5f876080015160200151602001516020015186036113cd57508361143b565b6113ea8860c00151866113e09190612332565b8960a00151611bea565b90505f811161143b5760405162461bcd60e51b815260206004820152601960248201527f4e6577207265736f6c766520646561646c696e652069732030000000000000006044820152606401610266565b5f54604051630e1e354960e41b81526004810189905260248101889052604481018390526001600160a01b039091169063e1e35490906064015f604051808303815f87803b15801561148b575f5ffd5b505af115801561149d573d5f5f3e3d5ffd5b505060408051898152602081018590528793507fa87e293885636c5018108e8ee0e41d65206d1dfc0a9066f26f2a91a78b2beb1792500160405180910390a25050505050505050565b61150a60405180606001604052806060815260200160608152602001606081525090565b604080518082019091525f80825260208201849052805b6020830151518351101561159a5761153883611714565b9092509050816001036115555761154e8361174c565b8452611521565b81600203611570576115668361174c565b6020850152611521565b8160030361158b576115818361174c565b6040850152611521565b6115958382611804565b611521565b505050919050565b604080518082018252606081525f602080830182905283518085019094528184528301849052909190805b6020830151518351101561159a576115e483611714565b909250905081600103611601576115fa8361174c565b84526115cd565b816002036116245761161a6116158461174c565b611c46565b60208501526115cd565b61162e8382611804565b6115cd565b5f5f5f5f6116418686611c7b565b9250925092506116518282611cc4565b5090949350505050565b815160609061166b836001612332565b67ffffffffffffffff81111561168357611683612228565b6040519080825280602002602001820160405280156116ac578160200160208202803683370190505b5091505f5f5b6020860151518651101561170b576116c986611714565b809250819350505060018483815181106116e5576116e5612214565b602002602001018181516116f99190612332565b9052506117068682611804565b6116b2565b50509092525090565b5f5f5f61172084611879565b905061172d600882612367565b9250806007166005811115611744576117446121ec565b915050915091565b60605f61175883611879565b90505f81845f015161176a9190612332565b905083602001515181111561177d575f5ffd5b8167ffffffffffffffff81111561179657611796612228565b6040519080825280601f01601f1916602001820160405280156117c0576020820181803683370190505b5060208086015186519295509181860191908301015f5b858110156117f95781810151838201526117f2602082612332565b90506117d7565b505050935250919050565b5f816005811115611817576118176121ec565b0361182a5761182582611879565b505050565b600281600581111561183e5761183e6121ec565b0361004a575f61184d83611879565b905080835f018181516118609190612332565b90525060208301515183511115611825575f5ffd5b5050565b60208082015182518101909101515f9182805b600a81101561004a5783811a91506118a5816007612386565b82607f16901b85179450816080165f036118e0576118c4816001612332565b865187906118d3908390612332565b9052509395945050505050565b60010161188c565b5f6109a582611d7c565b6118fa6120f2565b604080518082019091525f80825260208201849052805b6020830151518351101561159a5761192883611714565b90925090508160010361197d5761193e83611879565b600281111561194f5761194f6121ec565b84906002811115611962576119626121ec565b90816002811115611975576119756121ec565b905250611911565b816002036119a0576119966119918461174c565b611d99565b6020850152611911565b816003036119c7576119b46106188461174c565b6001600160a01b03166040850152611911565b816004036119e5576119db6119918461174c565b6060850152611911565b81600503611a00576119f68361174c565b6080850152611911565b81600603611a1b57611a118361174c565b60a0850152611911565b611a258382611804565b611911565b611a3261212e565b604080518082019091525f80825260208201849052805b6020830151518351101561159a57611a6083611714565b909250905081600103611ab557611a7683611879565b6005811115611a8757611a876121ec565b84906005811115611a9a57611a9a6121ec565b90816005811115611aad57611aad6121ec565b905250611a49565b81600203611ad857611ace611ac98461174c565b611daf565b6020850152611a49565b611ae28382611804565b611a49565b5f600182516002811115611afd57611afd6121ec565b03611b0a57506040015190565b600282516002811115611b1f57611b1f6121ec565b03611b9a576001546060830151604051635c23bdf560e01b81526001600160a01b0390921691635c23bdf591611b5b9160040190815260200190565b602060405180830381865afa158015611b76573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109a5919061239d565b60405162461bcd60e51b8152602060048201526016602482015275496e76616c696420636f6e646974696f6e207479706560501b6044820152606401610266565b5f8282188284110282186110b0565b5f8282188284100282186110b0565b5f8282604051602001611c2892919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b5f602082511115611c55575f5ffd5b6020820151905081516020611c6a91906123c3565b611c75906008612386565b1c919050565b5f5f5f8351604103611cb2576020840151604085015160608601515f1a611ca488828585611e65565b955095509550505050611cbd565b505081515f91506002905b9250925092565b5f826003811115611cd757611cd76121ec565b03611ce0575050565b6001826003811115611cf457611cf46121ec565b03611d125760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115611d2657611d266121ec565b03611d475760405163fce698f760e01b815260048101829052602401610266565b6003826003811115611d5b57611d5b6121ec565b03611875576040516335e2f38360e21b815260048101829052602401610266565b5f8151601414611d8a575f5ffd5b5060200151600160601b900490565b5f8151602014611da7575f5ffd5b506020015190565b604080516080810182525f8183018181526060830182905282528251808401845281815260208082018390528084019190915283518085019094528184528301849052909190805b6020830151518351101561159a57611e0e83611714565b909250905081600103611e3357611e2c611e278461174c565b611f2d565b8452611df7565b81600203611e5657611e4c611e478461174c565b611ffb565b6020850152611df7565b611e608382611804565b611df7565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115611e9e57505f91506003905082611f23565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015611eef573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116611f1a57505f925060019150829050611f23565b92505f91508190505b9450945094915050565b604080518082019091525f8082526020820152604080518082019091525f80825260208201849052505f5f5b6020830151518351101561159a57611f7083611714565b909250905081600103611fc557611f8683611879565b6002811115611f9757611f976121ec565b84906002811115611faa57611faa6121ec565b90816002811115611fbd57611fbd6121ec565b905250611f59565b81600203611fec57611fd96106188461174c565b6001600160a01b03166020850152611f59565b611ff68382611804565b611f59565b6040805180820182525f808252602080830182905283518085019094528184528301849052909190805b6020830151518351101561159a5761203c83611714565b909250905081600103612065576120556106188461174c565b6001600160a01b03168452612025565b81600203612083576120796116158461174c565b6020850152612025565b61208d8382611804565b612025565b6040518061010001604052805f81526020015f6001600160a01b031681526020015f6001600160a01b03168152602001606081526020016120d161212e565b81526020015f81526020015f81526020015f6001600160a01b031681525090565b6040805160c08101909152805f81526020015f81526020015f6001600160a01b031681526020015f815260200160608152602001606081525090565b60408051808201909152805f8152602001612179604080516080810182525f818301818152606083018290528252825180840190935280835260208381019190915290919082015290565b905290565b5f5f6020838503121561218f575f5ffd5b823567ffffffffffffffff8111156121a5575f5ffd5b8301601f810185136121b5575f5ffd5b803567ffffffffffffffff8111156121cb575f5ffd5b8560208284010111156121dc575f5ffd5b6020919091019590945092505050565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52600160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f600182016122615761226161223c565b5060010190565b6020808252600e908201526d57726f6e6720707265696d61676560901b604082015260600190565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f602082840312156122d5575f5ffd5b815180151581146110b0575f5ffd5b6020808252601a908201527f436f6e646974696f6e206973206e6f742066696e616c697a6564000000000000604082015260600190565b5f6020828403121561232b575f5ffd5b5051919050565b808201808211156109a5576109a561223c565b5f5f60408385031215612356575f5ffd5b505080516020909101519092909150565b5f8261238157634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176109a5576109a561223c565b5f602082840312156123ad575f5ffd5b81516001600160a01b03811681146110b0575f5ffd5b818103818111156109a5576109a561223c56fea26469706673582212204af8289435cb7d2a3d3a391eede8c85e90e1f1d22162d57dce28bd1aefc6df2c64736f6c634300081d0033", + Bin: "0x6080604052348015600e575f5ffd5b506040516124b93803806124b9833981016040819052602b916074565b5f80546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617905560a0565b80516001600160a01b0381168114606f575f5ffd5b919050565b5f5f604083850312156084575f5ffd5b608b83605a565b9150609760208401605a565b90509250929050565b61240c806100ad5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c80634367e45e1461004e57806353fc513f146100635780635fff88c814610091578063ead54c1b146100a4575b5f5ffd5b61006161005c36600461217e565b6100b7565b005b5f54610075906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b61006161009f36600461217e565b6101a7565b600154610075906001600160a01b031681565b5f6100f683838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061037392505050565b90505f610105825f015161050e565b6080810151519091505f9081816005811115610123576101236121ec565b0361013d5761013683856020015161076a565b9150610189565b6001816005811115610151576101516121ec565b03610164576101368385602001516109ab565b61016d81610bfb565b156101815761013683856020015183610c4e565b610189612200565b8351805160209091012061019e8482856110b7565b50505050505050565b5f6101e683838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506114e692505050565b90505f6101f5825f01516115a2565b90505f610204825f015161050e565b905080608001516020015160200151602001518260200151111561026f5760405162461bcd60e51b815260206004820152601a60248201527f457863656564206d6178207472616e7366657220616d6f756e7400000000000060448201526064015b60405180910390fd5b825180516020918201207f19457468657265756d205369676e6564204d6573736167653a0a3332000000005f908152601c91909152603c8120918501516102b7908390611633565b90505f6102d186604001518461163390919063ffffffff16565b905083602001516001600160a01b0316826001600160a01b031614801561030d575083604001516001600160a01b0316816001600160a01b0316145b61034d5760405162461bcd60e51b815260206004820152601160248201527010da1958dac81cda59dcc819985a5b1959607a1b6044820152606401610266565b845180516020918201209086015161036890869083906110b7565b505050505050505050565b60408051808201909152606080825260208201525f6103a483604080518082019091525f8152602081019190915290565b90505f6103b282600261165b565b9050806002815181106103c7576103c7612214565b602002602001015167ffffffffffffffff8111156103e7576103e7612228565b60405190808252806020026020018201604052801561041a57816020015b60608152602001906001900390816104055790505b5083602001819052505f8160028151811061043757610437612214565b6020026020010181815250505f5f5b602084015151845110156105055761045d84611714565b90925090508160010361047a576104738461174c565b8552610446565b816002036104f65761048b8461174c565b8560200151846002815181106104a3576104a3612214565b6020026020010151815181106104bb576104bb612214565b6020026020010181905250826002815181106104d9576104d9612214565b6020026020010180518091906104ee90612250565b905250610446565b6105008482611804565b610446565b50505050919050565b610516612092565b604080518082019091525f8082526020820184905261053682600861165b565b90508060048151811061054b5761054b612214565b602002602001015167ffffffffffffffff81111561056b5761056b612228565b6040519080825280602002602001820160405280156105a457816020015b6105916120f2565b8152602001906001900390816105895790505b5083606001819052505f816004815181106105c1576105c1612214565b6020026020010181815250505f5f5b60208401515184511015610505576105e784611714565b909250905081600103610604576105fd84611879565b85526105d0565b816002036106305761061d6106188561174c565b6118e8565b6001600160a01b031660208601526105d0565b81600303610657576106446106188561174c565b6001600160a01b031660408601526105d0565b816004036106db5761067061066b8561174c565b6118f2565b85606001518460048151811061068857610688612214565b6020026020010151815181106106a0576106a0612214565b6020026020010181905250826004815181106106be576106be612214565b6020026020010180518091906106d390612250565b9052506105d0565b816005036106fe576106f46106ef8561174c565b611a2a565b60808601526105d0565b816006036107195761070f84611879565b60a08601526105d0565b816007036107345761072a84611879565b60c08601526105d0565b8160080361075b576107486106188561174c565b6001600160a01b031660e08601526105d0565b6107658482611804565b6105d0565b5f8080805b85606001515181101561097e575f8660600151828151811061079357610793612214565b602002602001015190505f60028111156107af576107af6121ec565b815160028111156107c2576107c26121ec565b0361081c5780602001518685815181106107de576107de612214565b6020026020010151805190602001201461080a5760405162461bcd60e51b815260040161026690612268565b8361081481612250565b945050610975565b600181516002811115610831576108316121ec565b148061084f575060028151600281111561084d5761084d6121ec565b145b1561096d575f61085e82611ae7565b6080830151604051632f36f6a560e21b815291925082916001600160a01b0383169163bcdbda94916108939190600401612290565b602060405180830381865afa1580156108ae573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108d291906122c5565b6108ee5760405162461bcd60e51b8152600401610266906122e4565b60a083015160405163ea4ba8eb60e01b81526001600160a01b0383169163ea4ba8eb9161091e9190600401612290565b602060405180830381865afa158015610939573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061095d91906122c5565b61096657600194505b5050610975565b610975612200565b5060010161076f565b50801561098f575f925050506109a5565b8460800151602001516020015160200151925050505b92915050565b5f808080805b866060015151811015610bc5575f876060015182815181106109d5576109d5612214565b602002602001015190505f60028111156109f1576109f16121ec565b81516002811115610a0457610a046121ec565b03610a5e578060200151878681518110610a2057610a20612214565b60200260200101518051906020012014610a4c5760405162461bcd60e51b815260040161026690612268565b84610a5681612250565b955050610bbc565b600181516002811115610a7357610a736121ec565b1480610a915750600281516002811115610a8f57610a8f6121ec565b145b15610bb4575f610aa082611ae7565b6080830151604051632f36f6a560e21b815291925082916001600160a01b0383169163bcdbda9491610ad59190600401612290565b602060405180830381865afa158015610af0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b1491906122c5565b610b305760405162461bcd60e51b8152600401610266906122e4565b60a083015160405163ea4ba8eb60e01b8152600197506001600160a01b0383169163ea4ba8eb91610b649190600401612290565b602060405180830381865afa158015610b7f573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ba391906122c5565b15610bad57600194505b5050610bbc565b610bbc612200565b506001016109b1565b50811580610bd05750805b15610bf057856080015160200151602001516020015193505050506109a5565b5f93505050506109a5565b5f6003826005811115610c1057610c106121ec565b1480610c2d57506004826005811115610c2b57610c2b6121ec565b145b806109a557506005826005811115610c4757610c476121ec565b1492915050565b5f808080805b876060015151811015611027575f88606001518281518110610c7857610c78612214565b602002602001015190505f6002811115610c9457610c946121ec565b81516002811115610ca757610ca76121ec565b03610d01578060200151888581518110610cc357610cc3612214565b60200260200101518051906020012014610cef5760405162461bcd60e51b815260040161026690612268565b83610cf981612250565b94505061101e565b600181516002811115610d1657610d166121ec565b1480610d345750600281516002811115610d3257610d326121ec565b145b15611016575f610d4382611ae7565b6080830151604051632f36f6a560e21b815291925082916001600160a01b0383169163bcdbda9491610d789190600401612290565b602060405180830381865afa158015610d93573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610db791906122c5565b610dd35760405162461bcd60e51b8152600401610266906122e4565b6003896005811115610de757610de76121ec565b03610e6c5760a083015160405163ea4ba8eb60e01b81526001600160a01b0383169163ea4ba8eb91610e1c9190600401612290565b602060405180830381865afa158015610e37573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e5b919061231b565b610e659088612332565b965061100b565b6004896005811115610e8057610e806121ec565b03610efd57610e6587826001600160a01b031663ea4ba8eb8660a001516040518263ffffffff1660e01b8152600401610eb99190612290565b602060405180830381865afa158015610ed4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ef8919061231b565b611bdb565b6005896005811115610f1157610f116121ec565b03611003578415610f9457610e6587826001600160a01b031663ea4ba8eb8660a001516040518263ffffffff1660e01b8152600401610f509190612290565b602060405180830381865afa158015610f6b573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f8f919061231b565b611bea565b60a083015160405163ea4ba8eb60e01b81526001600160a01b0383169163ea4ba8eb91610fc49190600401612290565b602060405180830381865afa158015610fdf573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e65919061231b565b61100b612200565b60019450505061101e565b61101e612200565b50600101610c54565b50801561109957866080015160200151602001516020015183111561108e5760405162461bcd60e51b815260206004820152601a60248201527f457863656564206d6178207472616e7366657220616d6f756e740000000000006044820152606401610266565b8293505050506110b0565b866080015160200151602001516020015193505050505b9392505050565b60a083015142908111156111205760405162461bcd60e51b815260206004820152602a60248201527f50617373656420706179207265736f6c766520646561646c696e6520696e20636044820152696f6e64506179206d736760b01b6064820152608401610266565b5f61112b8430611bf9565b5f80546040516304f61c0b60e31b815260048101849052929350909182916001600160a01b0316906327b0e058906024016040805180830381865afa158015611176573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061119a9190612345565b91509150805f14806111ac5750808411155b6112045760405162461bcd60e51b815260206004820152602360248201527f506173736564206f6e636861696e207265736f6c76652070617920646561646c604482015262696e6560e81b6064820152608401610266565b80156113ae578185116112595760405162461bcd60e51b815260206004820152601860248201527f4e657720616d6f756e74206973206e6f74206c617267657200000000000000006044820152606401610266565b86608001516020015160200151602001518503611317575f54604051630e1e354960e41b81526004810188905260248101879052604481018690526001600160a01b039091169063e1e35490906064015f604051808303815f87803b1580156112c0575f5ffd5b505af11580156112d2573d5f5f3e3d5ffd5b505060408051888152602081018890528693507fa87e293885636c5018108e8ee0e41d65206d1dfc0a9066f26f2a91a78b2beb179250015b60405180910390a261019e565b5f5460405163f8fb012f60e01b815260048101889052602481018790526001600160a01b039091169063f8fb012f906044015f604051808303815f87803b158015611360575f5ffd5b505af1158015611372573d5f5f3e3d5ffd5b505060408051888152602081018590528693507fa87e293885636c5018108e8ee0e41d65206d1dfc0a9066f26f2a91a78b2beb1792500161130a565b5f876080015160200151602001516020015186036113cd57508361143b565b6113ea8860c00151866113e09190612332565b8960a00151611bea565b90505f811161143b5760405162461bcd60e51b815260206004820152601960248201527f4e6577207265736f6c766520646561646c696e652069732030000000000000006044820152606401610266565b5f54604051630e1e354960e41b81526004810189905260248101889052604481018390526001600160a01b039091169063e1e35490906064015f604051808303815f87803b15801561148b575f5ffd5b505af115801561149d573d5f5f3e3d5ffd5b505060408051898152602081018590528793507fa87e293885636c5018108e8ee0e41d65206d1dfc0a9066f26f2a91a78b2beb1792500160405180910390a25050505050505050565b61150a60405180606001604052806060815260200160608152602001606081525090565b604080518082019091525f80825260208201849052805b6020830151518351101561159a5761153883611714565b9092509050816001036115555761154e8361174c565b8452611521565b81600203611570576115668361174c565b6020850152611521565b8160030361158b576115818361174c565b6040850152611521565b6115958382611804565b611521565b505050919050565b604080518082018252606081525f602080830182905283518085019094528184528301849052909190805b6020830151518351101561159a576115e483611714565b909250905081600103611601576115fa8361174c565b84526115cd565b816002036116245761161a6116158461174c565b611c46565b60208501526115cd565b61162e8382611804565b6115cd565b5f5f5f5f6116418686611c7b565b9250925092506116518282611cc4565b5090949350505050565b815160609061166b836001612332565b67ffffffffffffffff81111561168357611683612228565b6040519080825280602002602001820160405280156116ac578160200160208202803683370190505b5091505f5f5b6020860151518651101561170b576116c986611714565b809250819350505060018483815181106116e5576116e5612214565b602002602001018181516116f99190612332565b9052506117068682611804565b6116b2565b50509092525090565b5f5f5f61172084611879565b905061172d600882612367565b9250806007166005811115611744576117446121ec565b915050915091565b60605f61175883611879565b90505f81845f015161176a9190612332565b905083602001515181111561177d575f5ffd5b8167ffffffffffffffff81111561179657611796612228565b6040519080825280601f01601f1916602001820160405280156117c0576020820181803683370190505b5060208086015186519295509181860191908301015f5b858110156117f95781810151838201526117f2602082612332565b90506117d7565b505050935250919050565b5f816005811115611817576118176121ec565b0361182a5761182582611879565b505050565b600281600581111561183e5761183e6121ec565b0361004a575f61184d83611879565b905080835f018181516118609190612332565b90525060208301515183511115611825575f5ffd5b5050565b60208082015182518101909101515f9182805b600a81101561004a5783811a91506118a5816007612386565b82607f16901b85179450816080165f036118e0576118c4816001612332565b865187906118d3908390612332565b9052509395945050505050565b60010161188c565b5f6109a582611d7c565b6118fa6120f2565b604080518082019091525f80825260208201849052805b6020830151518351101561159a5761192883611714565b90925090508160010361197d5761193e83611879565b600281111561194f5761194f6121ec565b84906002811115611962576119626121ec565b90816002811115611975576119756121ec565b905250611911565b816002036119a0576119966119918461174c565b611d99565b6020850152611911565b816003036119c7576119b46106188461174c565b6001600160a01b03166040850152611911565b816004036119e5576119db6119918461174c565b6060850152611911565b81600503611a00576119f68361174c565b6080850152611911565b81600603611a1b57611a118361174c565b60a0850152611911565b611a258382611804565b611911565b611a3261212e565b604080518082019091525f80825260208201849052805b6020830151518351101561159a57611a6083611714565b909250905081600103611ab557611a7683611879565b6005811115611a8757611a876121ec565b84906005811115611a9a57611a9a6121ec565b90816005811115611aad57611aad6121ec565b905250611a49565b81600203611ad857611ace611ac98461174c565b611daf565b6020850152611a49565b611ae28382611804565b611a49565b5f600182516002811115611afd57611afd6121ec565b03611b0a57506040015190565b600282516002811115611b1f57611b1f6121ec565b03611b9a576001546060830151604051635c23bdf560e01b81526001600160a01b0390921691635c23bdf591611b5b9160040190815260200190565b602060405180830381865afa158015611b76573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109a5919061239d565b60405162461bcd60e51b8152602060048201526016602482015275496e76616c696420636f6e646974696f6e207479706560501b6044820152606401610266565b5f8282188284110282186110b0565b5f8282188284100282186110b0565b5f8282604051602001611c2892919091825260601b6bffffffffffffffffffffffff1916602082015260340190565b60405160208183030381529060405280519060200120905092915050565b5f602082511115611c55575f5ffd5b6020820151905081516020611c6a91906123c3565b611c75906008612386565b1c919050565b5f5f5f8351604103611cb2576020840151604085015160608601515f1a611ca488828585611e65565b955095509550505050611cbd565b505081515f91506002905b9250925092565b5f826003811115611cd757611cd76121ec565b03611ce0575050565b6001826003811115611cf457611cf46121ec565b03611d125760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115611d2657611d266121ec565b03611d475760405163fce698f760e01b815260048101829052602401610266565b6003826003811115611d5b57611d5b6121ec565b03611875576040516335e2f38360e21b815260048101829052602401610266565b5f8151601414611d8a575f5ffd5b5060200151600160601b900490565b5f8151602014611da7575f5ffd5b506020015190565b604080516080810182525f8183018181526060830182905282528251808401845281815260208082018390528084019190915283518085019094528184528301849052909190805b6020830151518351101561159a57611e0e83611714565b909250905081600103611e3357611e2c611e278461174c565b611f2d565b8452611df7565b81600203611e5657611e4c611e478461174c565b611ffb565b6020850152611df7565b611e608382611804565b611df7565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115611e9e57505f91506003905082611f23565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015611eef573d5f5f3e3d5ffd5b5050604051601f1901519150506001600160a01b038116611f1a57505f925060019150829050611f23565b92505f91508190505b9450945094915050565b604080518082019091525f8082526020820152604080518082019091525f80825260208201849052505f5f5b6020830151518351101561159a57611f7083611714565b909250905081600103611fc557611f8683611879565b6002811115611f9757611f976121ec565b84906002811115611faa57611faa6121ec565b90816002811115611fbd57611fbd6121ec565b905250611f59565b81600203611fec57611fd96106188461174c565b6001600160a01b03166020850152611f59565b611ff68382611804565b611f59565b6040805180820182525f808252602080830182905283518085019094528184528301849052909190805b6020830151518351101561159a5761203c83611714565b909250905081600103612065576120556106188461174c565b6001600160a01b03168452612025565b81600203612083576120796116158461174c565b6020850152612025565b61208d8382611804565b612025565b6040518061010001604052805f81526020015f6001600160a01b031681526020015f6001600160a01b03168152602001606081526020016120d161212e565b81526020015f81526020015f81526020015f6001600160a01b031681525090565b6040805160c08101909152805f81526020015f81526020015f6001600160a01b031681526020015f815260200160608152602001606081525090565b60408051808201909152805f8152602001612179604080516080810182525f818301818152606083018290528252825180840190935280835260208381019190915290919082015290565b905290565b5f5f6020838503121561218f575f5ffd5b823567ffffffffffffffff8111156121a5575f5ffd5b8301601f810185136121b5575f5ffd5b803567ffffffffffffffff8111156121cb575f5ffd5b8560208284010111156121dc575f5ffd5b6020919091019590945092505050565b634e487b7160e01b5f52602160045260245ffd5b634e487b7160e01b5f52600160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f600182016122615761226161223c565b5060010190565b6020808252600e908201526d57726f6e6720707265696d61676560901b604082015260600190565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f602082840312156122d5575f5ffd5b815180151581146110b0575f5ffd5b6020808252601a908201527f436f6e646974696f6e206973206e6f742066696e616c697a6564000000000000604082015260600190565b5f6020828403121561232b575f5ffd5b5051919050565b808201808211156109a5576109a561223c565b5f5f60408385031215612356575f5ffd5b505080516020909101519092909150565b5f8261238157634e487b7160e01b5f52601260045260245ffd5b500490565b80820281158282048414176109a5576109a561223c565b5f602082840312156123ad575f5ffd5b81516001600160a01b03811681146110b0575f5ffd5b818103818111156109a5576109a561223c56fea26469706673582212208f1004bf702ea90805aa2480ee6a8286b55ec76d95408c5915a5b753208bb2e264736f6c634300081e0033", } // PayResolverABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/routerregistry/routerregistry.go b/chain/channel-eth-go/routerregistry/routerregistry.go index 4f419a4..bbc4151 100644 --- a/chain/channel-eth-go/routerregistry/routerregistry.go +++ b/chain/channel-eth-go/routerregistry/routerregistry.go @@ -32,7 +32,7 @@ var ( // RouterRegistryMetaData contains all meta data concerning the RouterRegistry contract. var RouterRegistryMetaData = &bind.MetaData{ ABI: "[{\"type\":\"function\",\"name\":\"deregisterRouter\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"refreshRouter\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerRouter\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"routerInfo\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"RouterUpdated\",\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\",\"indexed\":true,\"internalType\":\"enumIRouterRegistry.RouterOperation\"},{\"name\":\"routerAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", - Bin: "0x6080604052348015600e575f5ffd5b506102818061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c806324f277d21461004e5780632ff0282b146100585780637880945614610060578063d1cf70d114610091575b5f5ffd5b610056610099565b005b610056610136565b61007f61006e36600461021e565b5f6020819052908152604090205481565b60405190815260200160405180910390f35b6100566101ab565b335f90815260208190526040902054156100fa5760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320616c72656164792065786973747300000060448201526064015b60405180910390fd5b335f8181526020819052604081204390555b6040517fed739f5df64012854c2039ba144af8e3af26211fc7f10a959c6a592ae58c4491905f90a3565b335f9081526020819052604081205490036101935760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f818152602081905260409020439055600261010c565b335f9081526020819052604081205490036102085760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f81815260208190526040812055600161010c565b5f6020828403121561022e575f5ffd5b81356001600160a01b0381168114610244575f5ffd5b939250505056fea26469706673582212204a9798eb9c34c961b1979f06aa33fe45efd06fcbefd386adb4ffc2a6910bb30d64736f6c634300081d0033", + Bin: "0x6080604052348015600e575f5ffd5b506102818061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c806324f277d21461004e5780632ff0282b146100585780637880945614610060578063d1cf70d114610091575b5f5ffd5b610056610099565b005b610056610136565b61007f61006e36600461021e565b5f6020819052908152604090205481565b60405190815260200160405180910390f35b6100566101ab565b335f90815260208190526040902054156100fa5760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320616c72656164792065786973747300000060448201526064015b60405180910390fd5b335f8181526020819052604081204290555b6040517fed739f5df64012854c2039ba144af8e3af26211fc7f10a959c6a592ae58c4491905f90a3565b335f9081526020819052604081205490036101935760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f818152602081905260409020429055600261010c565b335f9081526020819052604081205490036102085760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f81815260208190526040812055600161010c565b5f6020828403121561022e575f5ffd5b81356001600160a01b0381168114610244575f5ffd5b939250505056fea264697066735822122022d5647e3ba34f507ce9aa3328e73a0e10522cc666f87eb783f4629fb6e1fbdc64736f6c634300081e0033", } // RouterRegistryABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/virtresolver/virtresolver.go b/chain/channel-eth-go/virtresolver/virtresolver.go index c427334..0aca591 100644 --- a/chain/channel-eth-go/virtresolver/virtresolver.go +++ b/chain/channel-eth-go/virtresolver/virtresolver.go @@ -32,7 +32,7 @@ var ( // VirtContractResolverMetaData contains all meta data concerning the VirtContractResolver contract. var VirtContractResolverMetaData = &bind.MetaData{ ABI: "[{\"type\":\"function\",\"name\":\"deploy\",\"inputs\":[{\"name\":\"_code\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_nonce\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"resolve\",\"inputs\":[{\"name\":\"_virtAddr\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"Deploy\",\"inputs\":[{\"name\":\"virtAddr\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false}]", - Bin: "0x6080604052348015600e575f5ffd5b506103648061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c80635c23bdf5146100385780639c4ae2d014610068575b5f5ffd5b61004b610046366004610293565b61008b565b6040516001600160a01b0390911681526020015b60405180910390f35b61007b6100763660046102aa565b61010e565b604051901515815260200161005f565b5f818152602081905260408120546001600160a01b03166100f35760405162461bcd60e51b815260206004820152601b60248201527f4e6f6e6578697374656e74207669727475616c2061646472657373000000000060448201526064015b60405180910390fd5b505f908152602081905260409020546001600160a01b031690565b5f5f8484846040516020016101259392919061031c565b6040516020818303038152906040528051906020012090505f85858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250868152602081905260409020549394505050506001600160a01b0316156101d85760405162461bcd60e51b815260206004820152601d60248201527f43757272656e74207265616c2061646472657373206973206e6f74203000000060448201526064016100ea565b5f8151602083015ff090506001600160a01b0381166102395760405162461bcd60e51b815260206004820152601760248201527f43726561746520636f6e7472616374206661696c65642e00000000000000000060448201526064016100ea565b5f8381526020819052604080822080546001600160a01b0319166001600160a01b0385161790555184917f149208daa30a9306858cc9c171c3510e0e50ab5d59ed2027a37a728430dd02e491a25060019695505050505050565b5f602082840312156102a3575f5ffd5b5035919050565b5f5f5f604084860312156102bc575f5ffd5b833567ffffffffffffffff8111156102d2575f5ffd5b8401601f810186136102e2575f5ffd5b803567ffffffffffffffff8111156102f8575f5ffd5b866020828401011115610309575f5ffd5b6020918201979096509401359392505050565b8284823790910190815260200191905056fea2646970667358221220d118366c009e18f360fd233859f12e12a1bb98f7e30d00aa6259f13aa52a748f64736f6c634300081d0033", + Bin: "0x6080604052348015600e575f5ffd5b506103648061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c80635c23bdf5146100385780639c4ae2d014610068575b5f5ffd5b61004b610046366004610293565b61008b565b6040516001600160a01b0390911681526020015b60405180910390f35b61007b6100763660046102aa565b61010e565b604051901515815260200161005f565b5f818152602081905260408120546001600160a01b03166100f35760405162461bcd60e51b815260206004820152601b60248201527f4e6f6e6578697374656e74207669727475616c2061646472657373000000000060448201526064015b60405180910390fd5b505f908152602081905260409020546001600160a01b031690565b5f5f8484846040516020016101259392919061031c565b6040516020818303038152906040528051906020012090505f85858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920182905250868152602081905260409020549394505050506001600160a01b0316156101d85760405162461bcd60e51b815260206004820152601d60248201527f43757272656e74207265616c2061646472657373206973206e6f74203000000060448201526064016100ea565b5f8151602083015ff090506001600160a01b0381166102395760405162461bcd60e51b815260206004820152601760248201527f43726561746520636f6e7472616374206661696c65642e00000000000000000060448201526064016100ea565b5f8381526020819052604080822080546001600160a01b0319166001600160a01b0385161790555184917f149208daa30a9306858cc9c171c3510e0e50ab5d59ed2027a37a728430dd02e491a25060019695505050505050565b5f602082840312156102a3575f5ffd5b5035919050565b5f5f5f604084860312156102bc575f5ffd5b833567ffffffffffffffff8111156102d2575f5ffd5b8401601f810186136102e2575f5ffd5b803567ffffffffffffffff8111156102f8575f5ffd5b866020828401011115610309575f5ffd5b6020918201979096509401359392505050565b8284823790910190815260200191905056fea26469706673582212201a345ef0281e1b23f511658aaf7664c8efc6b9a786cc0b36076021a932afe3e664736f6c634300081e0033", } // VirtContractResolverABI is the input ABI used to generate the binding from. diff --git a/chain/channel-eth-go/wallet/wallet.go b/chain/channel-eth-go/wallet/wallet.go index c6e9092..0f43b2e 100644 --- a/chain/channel-eth-go/wallet/wallet.go +++ b/chain/channel-eth-go/wallet/wallet.go @@ -32,7 +32,7 @@ var ( // CelerWalletMetaData contains all meta data concerning the CelerWallet contract. var CelerWalletMetaData = &bind.MetaData{ ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"create\",\"inputs\":[{\"name\":\"_owners\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"_operator\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_nonce\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"depositERC20\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_tokenAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"depositETH\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"drainToken\",\"inputs\":[{\"name\":\"_tokenAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getBalance\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_tokenAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getOperator\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getProposalVote\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getProposedNewOperator\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getWalletOwners\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposeNewOperator\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_newOperator\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOperatorship\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_newOperator\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferToWallet\",\"inputs\":[{\"name\":\"_fromWalletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_toWalletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_tokenAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"walletNum\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"_walletId\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_tokenAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"ChangeOperator\",\"inputs\":[{\"name\":\"walletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"oldOperator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOperator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CreateWallet\",\"inputs\":[{\"name\":\"walletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"owners\",\"type\":\"address[]\",\"indexed\":true,\"internalType\":\"address[]\"},{\"name\":\"operator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"DepositToWallet\",\"inputs\":[{\"name\":\"walletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"tokenAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"DrainToken\",\"inputs\":[{\"name\":\"tokenAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ProposeNewOperator\",\"inputs\":[{\"name\":\"walletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"newOperator\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"proposer\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TransferToWallet\",\"inputs\":[{\"name\":\"fromWalletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"toWalletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"tokenAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"WithdrawFromWallet\",\"inputs\":[{\"name\":\"walletId\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"tokenAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"receiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"EnforcedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ExpectedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OwnableInvalidOwner\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SafeERC20FailedOperation\",\"inputs\":[{\"name\":\"token\",\"type\":\"address\",\"internalType\":\"address\"}]}]", - Bin: "0x6080604052348015600e575f5ffd5b503380603357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b603a81603f565b506097565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b611546806100a45f395ff3fe60806040526004361061011b575f3560e01c80638456cb591161009d578063bfa2c1d211610062578063bfa2c1d214610334578063c108bb4014610353578063cafd460014610372578063d68d9d4e14610391578063f2fde38b146103a4575f5ffd5b80638456cb591461028a5780638da5cb5b1461029e5780638e0cc176146102bf578063a0c89a8c146102de578063a96a5f94146102fd575f5ffd5b80633f4ba83a116100e35780633f4ba83a14610202578063530e931c146102165780635c975abb14610235578063715018a61461025757806380ba952e1461026b575f5ffd5b80630d63a1fd1461011f57806314da2906146101515780631687cc60146101a0578063323c4480146101cc57806336cc9e8d146101ed575b5f5ffd5b34801561012a575f5ffd5b5061013e61013936600461112d565b6103c3565b6040519081526020015b60405180910390f35b34801561015c575f5ffd5b5061018861016b366004611213565b5f908152600260205260409020600301546001600160a01b031690565b6040516001600160a01b039091168152602001610148565b3480156101ab575f5ffd5b506101bf6101ba366004611213565b61053a565b604051610148919061122a565b3480156101d7575f5ffd5b506101eb6101e6366004611275565b6105a3565b005b3480156101f8575f5ffd5b5061013e60015481565b34801561020d575f5ffd5b506101eb6106b2565b348015610221575f5ffd5b5061013e610230366004611275565b6106c4565b348015610240575f5ffd5b505f5460ff165b6040519015158152602001610148565b348015610262575f5ffd5b506101eb6106ef565b348015610276575f5ffd5b506101eb61028536600461129f565b610700565b348015610295575f5ffd5b506101eb610801565b3480156102a9575f5ffd5b505f5461010090046001600160a01b0316610188565b3480156102ca575f5ffd5b506101eb6102d93660046112e9565b610811565b3480156102e9575f5ffd5b506101eb6102f8366004611275565b6108ea565b348015610308575f5ffd5b50610188610317366004611213565b5f908152600260205260409020600101546001600160a01b031690565b34801561033f575f5ffd5b506101eb61034e36600461132a565b61093b565b34801561035e575f5ffd5b506101eb61036d366004611353565b6109a3565b34801561037d575f5ffd5b5061024761038c366004611275565b610a10565b6101eb61039f366004611213565b610a6a565b3480156103af575f5ffd5b506101eb6103be366004611375565b610aba565b5f6103cc610af7565b6001600160a01b0383166103fb5760405162461bcd60e51b81526004016103f290611395565b60405180910390fd5b6040516bffffffffffffffffffffffff1930606090811b8216602084015233901b166034820152604881018390525f9060680160408051601f1981840301815291815281516020928301205f818152600290935291206001810154919250906001600160a01b0316156104a55760405162461bcd60e51b815260206004820152601260248201527113d8d8dd5c1a5959081dd85b1b195d081a5960721b60448201526064016103f2565b85516104b79082906020890190611087565b50600181810180546001600160a01b0319166001600160a01b0388161790558054905f6104e3836113e0565b9190505550846001600160a01b03168660405161050091906113f8565b6040519081900381209084907fe778e91533ef049a5fc99752bc4efb2b50ca4c967dfc0d4bb4782fb128070c34905f90a450949350505050565b5f8181526002602090815260409182902080548351818402810184019094528084526060939283018282801561059757602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610579575b50505050509050919050565b81336105af8282610b1a565b6105cb5760405162461bcd60e51b81526004016103f290611436565b6001600160a01b0383166105f15760405162461bcd60e51b81526004016103f290611395565b5f84815260026020526040902060038101546001600160a01b0385811691161461063c5761061e81610b81565b6003810180546001600160a01b0319166001600160a01b0386161790555b335f818152600483016020526040808220805460ff19166001179055516001600160a01b0387169188917f71f9e7796b33cb192d1670169ee7f4af7c5364f8f01bab4b95466787593745c39190a461069381610be5565b156106ab576106a28585610c52565b6106ab81610b81565b5050505050565b6106ba610cde565b6106c2610d10565b565b5f8281526002602081815260408084206001600160a01b038616855290920190529020545b92915050565b6106f7610cde565b6106c25f610d61565b610708610af7565b5f8581526002602052604090206001015485906001600160a01b031633146107425760405162461bcd60e51b81526004016103f290611477565b858361074e8282610b1a565b61076a5760405162461bcd60e51b81526004016103f290611436565b86856107768282610b1a565b6107925760405162461bcd60e51b81526004016103f290611436565b61079f8a89886001610db9565b6107ab8989885f610db9565b604080516001600160a01b038981168252602082018990528a16918b918d917f1b56f805e5edb1e61b0d3f46feffdcbab5e591aa0e70e978ada9fc22093601c8910160405180910390a450505050505050505050565b610809610cde565b6106c2610e68565b610819610af7565b5f8481526002602052604090206001015484906001600160a01b031633146108535760405162461bcd60e51b81526004016103f290611477565b848361085f8282610b1a565b61087b5760405162461bcd60e51b81526004016103f290611436565b6108888787866001610db9565b846001600160a01b0316866001600160a01b0316887fd897e862036b62a0f770979fbd2227f3210565bba2eb4d9acd1dc8ccc00c928b876040516108ce91815260200190565b60405180910390a46108e1868686610ea4565b50505050505050565b6108f2610af7565b5f8281526002602052604090206001015482906001600160a01b0316331461092c5760405162461bcd60e51b81526004016103f290611477565b6109368383610c52565b505050565b610943610f61565b61094b610cde565b816001600160a01b0316836001600160a01b03167f896ecb17b26927fb33933fc5f413873193bced3c59fe736c42968a9778bf6b588360405161099091815260200190565b60405180910390a3610936838383610ea4565b6109ab610af7565b6109b78383835f610db9565b816001600160a01b0316837fbc8e388b96ba8b9f627cb6d72d3513182f763c33c6107ecd31191de1f71abc1a836040516109f391815260200190565b60405180910390a36109366001600160a01b038316333084610f83565b5f8282610a1d8282610b1a565b610a395760405162461bcd60e51b81526004016103f290611436565b5050505f9182526002602090815260408084206001600160a01b039390931684526004909201905290205460ff1690565b610a72610af7565b34610a7f825f8381610db9565b6040518181525f9083907fbc8e388b96ba8b9f627cb6d72d3513182f763c33c6107ecd31191de1f71abc1a9060200160405180910390a35050565b610ac2610cde565b6001600160a01b038116610aeb57604051631e4fbdf760e01b81525f60048201526024016103f2565b610af481610d61565b50565b5f5460ff16156106c25760405163d93c066560e01b815260040160405180910390fd5b5f828152600260205260408120815b8154811015610b7757815f018181548110610b4657610b466114ae565b5f918252602090912001546001600160a01b0390811690851603610b6f576001925050506106e9565b600101610b29565b505f949350505050565b5f5b8154811015610be1575f826004015f845f018481548110610ba657610ba66114ae565b5f918252602080832091909101546001600160a01b031683528201929092526040019020805460ff1916911515919091179055600101610b83565b5050565b5f805b8254811015610c4957826004015f845f018381548110610c0a57610c0a6114ae565b5f9182526020808320909101546001600160a01b0316835282019290925260400181205460ff1615159003610c4157505f92915050565b600101610be8565b50600192915050565b6001600160a01b038116610c785760405162461bcd60e51b81526004016103f290611395565b5f828152600260205260408082206001810180546001600160a01b038681166001600160a01b031983168117909355935192949316929091839187917f118c3f8030bc3c8254e737a0bd0584403c33646afbcbee8321c3bd5b26543cda9190a450505050565b5f546001600160a01b036101009091041633146106c25760405163118cdaa760e01b81523360048201526024016103f2565b610d18610f61565b5f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b5f84815260026020526040812090826001811115610dd957610dd96114c2565b03610e22576001600160a01b0384165f908152600282016020526040902054610e039084906114d6565b6001600160a01b0385165f9081526002830160205260409020556106ab565b6001826001811115610e3657610e366114c2565b03610e60576001600160a01b0384165f908152600282016020526040902054610e039084906114e9565b6106ab6114fc565b610e70610af7565b5f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d443390565b6001600160a01b038316610f4d575f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610efb576040519150601f19603f3d011682016040523d82523d5f602084013e610f00565b606091505b5050905080610f475760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016103f2565b50505050565b6109366001600160a01b0384168383610fea565b5f5460ff166106c257604051638dfc202b60e01b815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610f479186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061101b565b6040516001600160a01b0383811660248301526044820183905261093691859182169063a9059cbb90606401610fb8565b5f5f60205f8451602086015f885af18061103a576040513d5f823e3d81fd5b50505f513d9150811561105157806001141561105e565b6001600160a01b0384163b155b15610f4757604051635274afe760e01b81526001600160a01b03851660048201526024016103f2565b828054828255905f5260205f209081019282156110da579160200282015b828111156110da57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906110a5565b506110e69291506110ea565b5090565b5b808211156110e6575f81556001016110eb565b634e487b7160e01b5f52604160045260245ffd5b80356001600160a01b0381168114611128575f5ffd5b919050565b5f5f5f6060848603121561113f575f5ffd5b833567ffffffffffffffff811115611155575f5ffd5b8401601f81018613611165575f5ffd5b803567ffffffffffffffff81111561117f5761117f6110fe565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156111ac576111ac6110fe565b6040529182526020818401810192908101898411156111c9575f5ffd5b6020850194505b838510156111ef576111e185611112565b8152602094850194016111d0565b5095506112029250505060208501611112565b929592945050506040919091013590565b5f60208284031215611223575f5ffd5b5035919050565b602080825282518282018190525f918401906040840190835b8181101561126a5783516001600160a01b0316835260209384019390920191600101611243565b509095945050505050565b5f5f60408385031215611286575f5ffd5b8235915061129660208401611112565b90509250929050565b5f5f5f5f5f60a086880312156112b3575f5ffd5b85359450602086013593506112ca60408701611112565b92506112d860608701611112565b949793965091946080013592915050565b5f5f5f5f608085870312156112fc575f5ffd5b8435935061130c60208601611112565b925061131a60408601611112565b9396929550929360600135925050565b5f5f5f6060848603121561133c575f5ffd5b61134584611112565b925061120260208501611112565b5f5f5f60608486031215611365575f5ffd5b8335925061120260208501611112565b5f60208284031215611385575f5ffd5b61138e82611112565b9392505050565b6020808252601a908201527f4e6577206f70657261746f722069732061646472657373283029000000000000604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b5f600182016113f1576113f16113cc565b5060010190565b81515f90829060208501835b8281101561142b5781516001600160a01b0316845260209384019390910190600101611404565b509195945050505050565b60208082526021908201527f476976656e2061646472657373206973206e6f742077616c6c6574206f776e656040820152603960f91b606082015260800190565b6020808252601a908201527f6d73672e73656e646572206973206e6f74206f70657261746f72000000000000604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b808201808211156106e9576106e96113cc565b818103818111156106e9576106e96113cc565b634e487b7160e01b5f52600160045260245ffdfea2646970667358221220130afc0ebf80d603b7c1b36fb0de1b053dd8e061bec7332b0d892e42a91e785364736f6c634300081e0033", + Bin: "0x6080604052348015600e575f5ffd5b503380603357604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b603a81603f565b506097565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b611546806100a45f395ff3fe60806040526004361061011b575f3560e01c80638456cb591161009d578063bfa2c1d211610062578063bfa2c1d214610334578063c108bb4014610353578063cafd460014610372578063d68d9d4e14610391578063f2fde38b146103a4575f5ffd5b80638456cb591461028a5780638da5cb5b1461029e5780638e0cc176146102bf578063a0c89a8c146102de578063a96a5f94146102fd575f5ffd5b80633f4ba83a116100e35780633f4ba83a14610202578063530e931c146102165780635c975abb14610235578063715018a61461025757806380ba952e1461026b575f5ffd5b80630d63a1fd1461011f57806314da2906146101515780631687cc60146101a0578063323c4480146101cc57806336cc9e8d146101ed575b5f5ffd5b34801561012a575f5ffd5b5061013e61013936600461112d565b6103c3565b6040519081526020015b60405180910390f35b34801561015c575f5ffd5b5061018861016b366004611213565b5f908152600260205260409020600301546001600160a01b031690565b6040516001600160a01b039091168152602001610148565b3480156101ab575f5ffd5b506101bf6101ba366004611213565b61053a565b604051610148919061122a565b3480156101d7575f5ffd5b506101eb6101e6366004611275565b6105a3565b005b3480156101f8575f5ffd5b5061013e60015481565b34801561020d575f5ffd5b506101eb6106b2565b348015610221575f5ffd5b5061013e610230366004611275565b6106c4565b348015610240575f5ffd5b505f5460ff165b6040519015158152602001610148565b348015610262575f5ffd5b506101eb6106ef565b348015610276575f5ffd5b506101eb61028536600461129f565b610700565b348015610295575f5ffd5b506101eb610801565b3480156102a9575f5ffd5b505f5461010090046001600160a01b0316610188565b3480156102ca575f5ffd5b506101eb6102d93660046112e9565b610811565b3480156102e9575f5ffd5b506101eb6102f8366004611275565b6108ea565b348015610308575f5ffd5b50610188610317366004611213565b5f908152600260205260409020600101546001600160a01b031690565b34801561033f575f5ffd5b506101eb61034e36600461132a565b61093b565b34801561035e575f5ffd5b506101eb61036d366004611353565b6109a3565b34801561037d575f5ffd5b5061024761038c366004611275565b610a10565b6101eb61039f366004611213565b610a6a565b3480156103af575f5ffd5b506101eb6103be366004611375565b610aba565b5f6103cc610af7565b6001600160a01b0383166103fb5760405162461bcd60e51b81526004016103f290611395565b60405180910390fd5b6040516bffffffffffffffffffffffff1930606090811b8216602084015233901b166034820152604881018390525f9060680160408051601f1981840301815291815281516020928301205f818152600290935291206001810154919250906001600160a01b0316156104a55760405162461bcd60e51b815260206004820152601260248201527113d8d8dd5c1a5959081dd85b1b195d081a5960721b60448201526064016103f2565b85516104b79082906020890190611087565b50600181810180546001600160a01b0319166001600160a01b0388161790558054905f6104e3836113e0565b9190505550846001600160a01b03168660405161050091906113f8565b6040519081900381209084907fe778e91533ef049a5fc99752bc4efb2b50ca4c967dfc0d4bb4782fb128070c34905f90a450949350505050565b5f8181526002602090815260409182902080548351818402810184019094528084526060939283018282801561059757602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610579575b50505050509050919050565b81336105af8282610b1a565b6105cb5760405162461bcd60e51b81526004016103f290611436565b6001600160a01b0383166105f15760405162461bcd60e51b81526004016103f290611395565b5f84815260026020526040902060038101546001600160a01b0385811691161461063c5761061e81610b81565b6003810180546001600160a01b0319166001600160a01b0386161790555b335f818152600483016020526040808220805460ff19166001179055516001600160a01b0387169188917f71f9e7796b33cb192d1670169ee7f4af7c5364f8f01bab4b95466787593745c39190a461069381610be5565b156106ab576106a28585610c52565b6106ab81610b81565b5050505050565b6106ba610cde565b6106c2610d10565b565b5f8281526002602081815260408084206001600160a01b038616855290920190529020545b92915050565b6106f7610cde565b6106c25f610d61565b610708610af7565b5f8581526002602052604090206001015485906001600160a01b031633146107425760405162461bcd60e51b81526004016103f290611477565b858361074e8282610b1a565b61076a5760405162461bcd60e51b81526004016103f290611436565b86856107768282610b1a565b6107925760405162461bcd60e51b81526004016103f290611436565b61079f8a89886001610db9565b6107ab8989885f610db9565b604080516001600160a01b038981168252602082018990528a16918b918d917f1b56f805e5edb1e61b0d3f46feffdcbab5e591aa0e70e978ada9fc22093601c8910160405180910390a450505050505050505050565b610809610cde565b6106c2610e68565b610819610af7565b5f8481526002602052604090206001015484906001600160a01b031633146108535760405162461bcd60e51b81526004016103f290611477565b848361085f8282610b1a565b61087b5760405162461bcd60e51b81526004016103f290611436565b6108888787866001610db9565b846001600160a01b0316866001600160a01b0316887fd897e862036b62a0f770979fbd2227f3210565bba2eb4d9acd1dc8ccc00c928b876040516108ce91815260200190565b60405180910390a46108e1868686610ea4565b50505050505050565b6108f2610af7565b5f8281526002602052604090206001015482906001600160a01b0316331461092c5760405162461bcd60e51b81526004016103f290611477565b6109368383610c52565b505050565b610943610f61565b61094b610cde565b816001600160a01b0316836001600160a01b03167f896ecb17b26927fb33933fc5f413873193bced3c59fe736c42968a9778bf6b588360405161099091815260200190565b60405180910390a3610936838383610ea4565b6109ab610af7565b6109b78383835f610db9565b816001600160a01b0316837fbc8e388b96ba8b9f627cb6d72d3513182f763c33c6107ecd31191de1f71abc1a836040516109f391815260200190565b60405180910390a36109366001600160a01b038316333084610f83565b5f8282610a1d8282610b1a565b610a395760405162461bcd60e51b81526004016103f290611436565b5050505f9182526002602090815260408084206001600160a01b039390931684526004909201905290205460ff1690565b610a72610af7565b34610a7f825f8381610db9565b6040518181525f9083907fbc8e388b96ba8b9f627cb6d72d3513182f763c33c6107ecd31191de1f71abc1a9060200160405180910390a35050565b610ac2610cde565b6001600160a01b038116610aeb57604051631e4fbdf760e01b81525f60048201526024016103f2565b610af481610d61565b50565b5f5460ff16156106c25760405163d93c066560e01b815260040160405180910390fd5b5f828152600260205260408120815b8154811015610b7757815f018181548110610b4657610b466114ae565b5f918252602090912001546001600160a01b0390811690851603610b6f576001925050506106e9565b600101610b29565b505f949350505050565b5f5b8154811015610be1575f826004015f845f018481548110610ba657610ba66114ae565b5f918252602080832091909101546001600160a01b031683528201929092526040019020805460ff1916911515919091179055600101610b83565b5050565b5f805b8254811015610c4957826004015f845f018381548110610c0a57610c0a6114ae565b5f9182526020808320909101546001600160a01b0316835282019290925260400181205460ff1615159003610c4157505f92915050565b600101610be8565b50600192915050565b6001600160a01b038116610c785760405162461bcd60e51b81526004016103f290611395565b5f828152600260205260408082206001810180546001600160a01b038681166001600160a01b031983168117909355935192949316929091839187917f118c3f8030bc3c8254e737a0bd0584403c33646afbcbee8321c3bd5b26543cda9190a450505050565b5f546001600160a01b036101009091041633146106c25760405163118cdaa760e01b81523360048201526024016103f2565b610d18610f61565b5f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b5f84815260026020526040812090826001811115610dd957610dd96114c2565b03610e22576001600160a01b0384165f908152600282016020526040902054610e039084906114d6565b6001600160a01b0385165f9081526002830160205260409020556106ab565b6001826001811115610e3657610e366114c2565b03610e60576001600160a01b0384165f908152600282016020526040902054610e039084906114e9565b6106ab6114fc565b610e70610af7565b5f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610d443390565b6001600160a01b038316610f4d575f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114610efb576040519150601f19603f3d011682016040523d82523d5f602084013e610f00565b606091505b5050905080610f475760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b60448201526064016103f2565b50505050565b6109366001600160a01b0384168383610fea565b5f5460ff166106c257604051638dfc202b60e01b815260040160405180910390fd5b6040516001600160a01b038481166024830152838116604483015260648201839052610f479186918216906323b872dd906084015b604051602081830303815290604052915060e01b6020820180516001600160e01b03838183161783525050505061101b565b6040516001600160a01b0383811660248301526044820183905261093691859182169063a9059cbb90606401610fb8565b5f5f60205f8451602086015f885af18061103a576040513d5f823e3d81fd5b50505f513d9150811561105157806001141561105e565b6001600160a01b0384163b155b15610f4757604051635274afe760e01b81526001600160a01b03851660048201526024016103f2565b828054828255905f5260205f209081019282156110da579160200282015b828111156110da57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906110a5565b506110e69291506110ea565b5090565b5b808211156110e6575f81556001016110eb565b634e487b7160e01b5f52604160045260245ffd5b80356001600160a01b0381168114611128575f5ffd5b919050565b5f5f5f6060848603121561113f575f5ffd5b833567ffffffffffffffff811115611155575f5ffd5b8401601f81018613611165575f5ffd5b803567ffffffffffffffff81111561117f5761117f6110fe565b8060051b604051601f19603f830116810181811067ffffffffffffffff821117156111ac576111ac6110fe565b6040529182526020818401810192908101898411156111c9575f5ffd5b6020850194505b838510156111ef576111e185611112565b8152602094850194016111d0565b5095506112029250505060208501611112565b929592945050506040919091013590565b5f60208284031215611223575f5ffd5b5035919050565b602080825282518282018190525f918401906040840190835b8181101561126a5783516001600160a01b0316835260209384019390920191600101611243565b509095945050505050565b5f5f60408385031215611286575f5ffd5b8235915061129660208401611112565b90509250929050565b5f5f5f5f5f60a086880312156112b3575f5ffd5b85359450602086013593506112ca60408701611112565b92506112d860608701611112565b949793965091946080013592915050565b5f5f5f5f608085870312156112fc575f5ffd5b8435935061130c60208601611112565b925061131a60408601611112565b9396929550929360600135925050565b5f5f5f6060848603121561133c575f5ffd5b61134584611112565b925061120260208501611112565b5f5f5f60608486031215611365575f5ffd5b8335925061120260208501611112565b5f60208284031215611385575f5ffd5b61138e82611112565b9392505050565b6020808252601a908201527f4e6577206f70657261746f722069732061646472657373283029000000000000604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b5f600182016113f1576113f16113cc565b5060010190565b81515f90829060208501835b8281101561142b5781516001600160a01b0316845260209384019390910190600101611404565b509195945050505050565b60208082526021908201527f476976656e2061646472657373206973206e6f742077616c6c6574206f776e656040820152603960f91b606082015260800190565b6020808252601a908201527f6d73672e73656e646572206973206e6f74206f70657261746f72000000000000604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b808201808211156106e9576106e96113cc565b818103818111156106e9576106e96113cc565b634e487b7160e01b5f52600160045260245ffdfea26469706673582212201b9b4b6c183e79cec68d9f0ccf2b588af7aa700a4362844ad962a1fcf60f1f7d64736f6c634300081e0033", } // CelerWalletABI is the input ABI used to generate the binding from. diff --git a/chain/erc20.go b/chain/erc20.go index 455aef1..58f9785 100644 --- a/chain/erc20.go +++ b/chain/erc20.go @@ -32,7 +32,7 @@ var ( // ERC20MetaData contains all meta data concerning the ERC20 contract. var ERC20MetaData = &bind.MetaData{ ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"DECIMALS\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"INITIAL_SUPPLY\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"spender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ERC20InsufficientAllowance\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"allowance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC20InsufficientBalance\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"needed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidApprover\",\"inputs\":[{\"name\":\"approver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidReceiver\",\"inputs\":[{\"name\":\"receiver\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidSender\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC20InvalidSpender\",\"inputs\":[{\"name\":\"spender\",\"type\":\"address\",\"internalType\":\"address\"}]}]", - Bin: "0x608060405234801561000f575f5ffd5b506040518060400160405280601181526020017022a921991822bc30b6b83632aa37b5b2b760791b81525060405180604001604052806005815260200164045455432360dc1b81525081600390816100679190610293565b5060046100748282610293565b505050610093336b204fce5e3e2502611000000061009860201b60201c565b610372565b6001600160a01b0382166100c65760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b6100d15f83836100d5565b5050565b6001600160a01b0383166100ff578060025f8282546100f4919061034d565b9091555061016f9050565b6001600160a01b0383165f90815260208190526040902054818110156101515760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016100bd565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661018b576002805482900390556101a9565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516101ee91815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061022357607f821691505b60208210810361024157634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561028e57805f5260205f20601f840160051c8101602085101561026c5750805b601f840160051c820191505b8181101561028b575f8155600101610278565b50505b505050565b81516001600160401b038111156102ac576102ac6101fb565b6102c0816102ba845461020f565b84610247565b6020601f8211600181146102f2575f83156102db5750848201515b5f19600385901b1c1916600184901b17845561028b565b5f84815260208120601f198516915b828110156103215787850151825560209485019460019092019101610301565b508482101561033e57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b8082018082111561036c57634e487b7160e01b5f52601160045260245ffd5b92915050565b61071f8061037f5f395ff3fe608060405234801561000f575f5ffd5b50600436106100a6575f3560e01c80632ff2e9dc1161006e5780632ff2e9dc1461012a578063313ce5671461013d57806370a082311461014457806395d89b411461016c578063a9059cbb14610174578063dd62ed3e14610187575f5ffd5b806306fdde03146100aa578063095ea7b3146100c857806318160ddd146100eb57806323b872dd146100fd5780632e0f262514610110575b5f5ffd5b6100b26101bf565b6040516100bf919061058f565b60405180910390f35b6100db6100d63660046105df565b61024f565b60405190151581526020016100bf565b6002545b6040519081526020016100bf565b6100db61010b366004610607565b610268565b610118601281565b60405160ff90911681526020016100bf565b6100ef6b204fce5e3e2502611000000081565b6012610118565b6100ef610152366004610641565b6001600160a01b03165f9081526020819052604090205490565b6100b261028b565b6100db6101823660046105df565b61029a565b6100ef610195366004610661565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6060600380546101ce90610692565b80601f01602080910402602001604051908101604052809291908181526020018280546101fa90610692565b80156102455780601f1061021c57610100808354040283529160200191610245565b820191905f5260205f20905b81548152906001019060200180831161022857829003601f168201915b5050505050905090565b5f3361025c8185856102a7565b60019150505b92915050565b5f336102758582856102b9565b61028085858561033a565b506001949350505050565b6060600480546101ce90610692565b5f3361025c81858561033a565b6102b48383836001610397565b505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f19811015610334578181101561032657604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b61033484848484035f610397565b50505050565b6001600160a01b03831661036357604051634b637e8f60e11b81525f600482015260240161031d565b6001600160a01b03821661038c5760405163ec442f0560e01b81525f600482015260240161031d565b6102b4838383610469565b6001600160a01b0384166103c05760405163e602df0560e01b81525f600482015260240161031d565b6001600160a01b0383166103e957604051634a1406b160e11b81525f600482015260240161031d565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561033457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161045b91815260200190565b60405180910390a350505050565b6001600160a01b038316610493578060025f82825461048891906106ca565b909155506105039050565b6001600160a01b0383165f90815260208190526040902054818110156104e55760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161031d565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661051f5760028054829003905561053d565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161058291815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b03811681146105da575f5ffd5b919050565b5f5f604083850312156105f0575f5ffd5b6105f9836105c4565b946020939093013593505050565b5f5f5f60608486031215610619575f5ffd5b610622846105c4565b9250610630602085016105c4565b929592945050506040919091013590565b5f60208284031215610651575f5ffd5b61065a826105c4565b9392505050565b5f5f60408385031215610672575f5ffd5b61067b836105c4565b9150610689602084016105c4565b90509250929050565b600181811c908216806106a657607f821691505b6020821081036106c457634e487b7160e01b5f52602260045260245ffd5b50919050565b8082018082111561026257634e487b7160e01b5f52601160045260245ffdfea26469706673582212205971b674aa65d249d06ee9a9e9e7537bc9edc4f1c46d1c6c207406546fdcafd564736f6c634300081d0033", + Bin: "0x608060405234801561000f575f5ffd5b506040518060400160405280601181526020017022a921991822bc30b6b83632aa37b5b2b760791b81525060405180604001604052806005815260200164045455432360dc1b81525081600390816100679190610293565b5060046100748282610293565b505050610093336b204fce5e3e2502611000000061009860201b60201c565b610372565b6001600160a01b0382166100c65760405163ec442f0560e01b81525f60048201526024015b60405180910390fd5b6100d15f83836100d5565b5050565b6001600160a01b0383166100ff578060025f8282546100f4919061034d565b9091555061016f9050565b6001600160a01b0383165f90815260208190526040902054818110156101515760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016100bd565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661018b576002805482900390556101a9565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516101ee91815260200190565b60405180910390a3505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061022357607f821691505b60208210810361024157634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561028e57805f5260205f20601f840160051c8101602085101561026c5750805b601f840160051c820191505b8181101561028b575f8155600101610278565b50505b505050565b81516001600160401b038111156102ac576102ac6101fb565b6102c0816102ba845461020f565b84610247565b6020601f8211600181146102f2575f83156102db5750848201515b5f19600385901b1c1916600184901b17845561028b565b5f84815260208120601f198516915b828110156103215787850151825560209485019460019092019101610301565b508482101561033e57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b8082018082111561036c57634e487b7160e01b5f52601160045260245ffd5b92915050565b61071f8061037f5f395ff3fe608060405234801561000f575f5ffd5b50600436106100a6575f3560e01c80632ff2e9dc1161006e5780632ff2e9dc1461012a578063313ce5671461013d57806370a082311461014457806395d89b411461016c578063a9059cbb14610174578063dd62ed3e14610187575f5ffd5b806306fdde03146100aa578063095ea7b3146100c857806318160ddd146100eb57806323b872dd146100fd5780632e0f262514610110575b5f5ffd5b6100b26101bf565b6040516100bf919061058f565b60405180910390f35b6100db6100d63660046105df565b61024f565b60405190151581526020016100bf565b6002545b6040519081526020016100bf565b6100db61010b366004610607565b610268565b610118601281565b60405160ff90911681526020016100bf565b6100ef6b204fce5e3e2502611000000081565b6012610118565b6100ef610152366004610641565b6001600160a01b03165f9081526020819052604090205490565b6100b261028b565b6100db6101823660046105df565b61029a565b6100ef610195366004610661565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6060600380546101ce90610692565b80601f01602080910402602001604051908101604052809291908181526020018280546101fa90610692565b80156102455780601f1061021c57610100808354040283529160200191610245565b820191905f5260205f20905b81548152906001019060200180831161022857829003601f168201915b5050505050905090565b5f3361025c8185856102a7565b60019150505b92915050565b5f336102758582856102b9565b61028085858561033a565b506001949350505050565b6060600480546101ce90610692565b5f3361025c81858561033a565b6102b48383836001610397565b505050565b6001600160a01b038381165f908152600160209081526040808320938616835292905220545f19811015610334578181101561032657604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b61033484848484035f610397565b50505050565b6001600160a01b03831661036357604051634b637e8f60e11b81525f600482015260240161031d565b6001600160a01b03821661038c5760405163ec442f0560e01b81525f600482015260240161031d565b6102b4838383610469565b6001600160a01b0384166103c05760405163e602df0560e01b81525f600482015260240161031d565b6001600160a01b0383166103e957604051634a1406b160e11b81525f600482015260240161031d565b6001600160a01b038085165f908152600160209081526040808320938716835292905220829055801561033457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161045b91815260200190565b60405180910390a350505050565b6001600160a01b038316610493578060025f82825461048891906106ca565b909155506105039050565b6001600160a01b0383165f90815260208190526040902054818110156104e55760405163391434e360e21b81526001600160a01b0385166004820152602481018290526044810183905260640161031d565b6001600160a01b0384165f9081526020819052604090209082900390555b6001600160a01b03821661051f5760028054829003905561053d565b6001600160a01b0382165f9081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161058291815260200190565b60405180910390a3505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b80356001600160a01b03811681146105da575f5ffd5b919050565b5f5f604083850312156105f0575f5ffd5b6105f9836105c4565b946020939093013593505050565b5f5f5f60608486031215610619575f5ffd5b610622846105c4565b9250610630602085016105c4565b929592945050506040919091013590565b5f60208284031215610651575f5ffd5b61065a826105c4565b9392505050565b5f5f60408385031215610672575f5ffd5b61067b836105c4565b9150610689602084016105c4565b90509250929050565b600181811c908216806106a657607f821691505b6020821081036106c457634e487b7160e01b5f52602260045260245ffd5b50919050565b8082018082111561026257634e487b7160e01b5f52601160045260245ffdfea26469706673582212206a6cc07e76149b82a796c875f3f4a170d0243e12d896731fcdcb78cab4ad7b1a64736f6c634300081e0033", } // ERC20ABI is the input ABI used to generate the binding from. diff --git a/client/api.go b/client/api.go index c51fd3c..022a2aa 100644 --- a/client/api.go +++ b/client/api.go @@ -31,7 +31,7 @@ func (cb *mycb) HandleOpenChannelFinish(cid ctype.CidType) { tokenAddr := cb.tokenAddr log.Infoln("Opened channel for tokenAddr", tokenAddr.Hex(), "cid", cid.Hex()) if cb.dal != nil { - cb.setBlkNumTo0() + cb.resetOpenTs() } if cb.appcb != nil { go cb.appcb.HandleChannelOpened(ctype.Addr2Hex(cb.tokenAddr), ctype.Cid2Hex(cid)) @@ -41,18 +41,20 @@ func (cb *mycb) HandleOpenChannelFinish(cid ctype.CidType) { func (cb *mycb) HandleOpenChannelErr(e *common.E) { log.Error("Openchannel err:", *e) if cb.dal != nil { - cb.setBlkNumTo0() + cb.resetOpenTs() } if cb.appcb != nil { go cb.appcb.HandleOpenChannelError(ctype.Addr2Hex(cb.tokenAddr), e.Reason) } } -// set lastOpenChanReqBlkNum to 0 -func (cb *mycb) setBlkNumTo0() { - err := cb.dal.UpsertDestTokenOpenChanBlkNum(cb.svrEth, utils.GetTokenInfoFromAddress(cb.tokenAddr), 0) +// resetOpenTs clears the open-channel timestamp for this client's +// (peer, token), used when an open-channel request fails so the next +// request gets a fresh timestamp. +func (cb *mycb) resetOpenTs() { + err := cb.dal.UpsertDestTokenOpenTs(cb.svrEth, utils.GetTokenInfoFromAddress(cb.tokenAddr), 0) if err != nil { - log.Warnln("setBlkNumTo0 err:", err) + log.Warnln("resetOpenTs err:", err) } } @@ -77,9 +79,9 @@ func (c *CelerClient) OpenChannel( } return nil } - err := c.dal.UpsertDestTokenOpenChanBlkNum(c.svrEth, token, c.GetCurrentBlockNumberUint64()) + err := c.dal.UpsertDestTokenOpenTs(c.svrEth, token, uint64(time.Now().Unix())) if err != nil { - log.Warnln("OpenChannel: cannot save block number:", err) + log.Warnln("OpenChannel: cannot save open-channel timestamp:", err) } return c.cNode.OpenChannel( c.svrEth, @@ -131,7 +133,7 @@ func (c *CelerClient) AddBooleanPay( if xfer == nil || xfer.Receiver == nil || xfer.Receiver.Account == nil { return ctype.ZeroPayID, common.ErrInvalidArg } - if resolveDeadline <= c.GetCurrentBlockNumber().Uint64() { + if resolveDeadline <= uint64(time.Now().Unix()) { return ctype.ZeroPayID, common.ErrDeadlinePassed } diff --git a/client/app_channel.go b/client/app_channel.go index e82d2d0..24dd06c 100644 --- a/client/app_channel.go +++ b/client/app_channel.go @@ -3,119 +3,38 @@ package client import ( - "math/big" - - "github.com/celer-network/agent-pay/app" - "github.com/celer-network/agent-pay/common" "github.com/celer-network/agent-pay/ctype" ) -// NewAppChannelOnVirtualContract initializes a generalized state channel with a virtual contract -// It returns the virtual address of the channel +// NewAppChannelOnVirtualContract registers a VIRTUAL_CONTRACT condition +// contract on the cnode and returns its deterministic virtual-contract address +// (used as the session id / Condition.OnChainAddress for VIRTUAL_CONTRACT pays). +// The bytecode + constructor + nonce are stored so the contract can be deployed +// on-chain on demand (e.g. on dispute or during outcome query). func (c *CelerClient) NewAppChannelOnVirtualContract( byteCode []byte, constructor []byte, - nonce uint64, - onchainTimeout uint64, - sc common.StateCallback) (string, error) { - return c.cNode.AppClient.NewAppChannelOnVirtualContract(byteCode, constructor, nonce, onchainTimeout, sc) -} - -// NewAppChannelOnDeployedContract initializes a generalized state channel with a deployed contract -// It returns the session ID of the channel -func (c *CelerClient) NewAppChannelOnDeployedContract( - contractAddr ctype.Addr, - nonce uint64, - players []ctype.Addr, - onchainTimeout uint64, - sc common.StateCallback) (string, error) { - return c.cNode.AppClient.NewAppChannelOnDeployedContract(contractAddr, nonce, players, onchainTimeout, sc) + nonce uint64) (string, error) { + return c.cNode.AppClient.NewAppChannelOnVirtualContract(byteCode, constructor, nonce) } -// DeleteAppChannel removes the app channel info from the in memory map -func (c *CelerClient) DeleteAppChannel(cid string) error { +// DeleteAppChannel removes the registered virtual condition contract from the +// cnode's in-memory bookkeeping. Does not touch on-chain state. +func (c *CelerClient) DeleteAppChannel(cid string) { c.cNode.AppClient.DeleteAppChannel(cid) - return nil -} - -// SettleAppChannel tries to settle a app channel onchain -func (c *CelerClient) SettleAppChannel(cid string, stateproof []byte) error { - return c.cNode.AppClient.SettleAppChannel(cid, stateproof) } -// GetAppChannelDeployedAddr get the depolyed address of a app channel -// returns error if it's an undeployed virtual contract channel +// GetAppChannelDeployedAddr returns the on-chain deployed address of a +// registered virtual condition contract, probing the virt-resolver if needed. +// Returns an error if the contract has not been deployed yet. func (c *CelerClient) GetAppChannelDeployedAddr(cid string) (ctype.Addr, error) { return c.cNode.AppClient.GetAppChannelDeployedAddr(cid) } -func (c *CelerClient) GetAppChannel(cid string) *app.AppChannel { - return c.cNode.AppClient.GetAppChannel(cid) -} - -// SignAppState returns 1: proto serialized app state, 2: signature, 3: error -func (c *CelerClient) SignAppState(cid string, seqNum uint64, state []byte) ([]byte, []byte, error) { - return c.cNode.AppClient.SignAppState(cid, seqNum, state) -} - -// ---------- after switch to onchain --------- - -// OnChainGetAppChannelBooleanOutcome returns 1: isFinalized(cid), 2: getOutcome(query), 3: error +// OnChainGetAppChannelBooleanOutcome queries IBooleanCond.{isFinalized, +// getOutcome} on the registered condition contract. For VIRTUAL_CONTRACT this +// triggers deploy-on-query: if the virtual contract has not been deployed yet, +// this call submits a deployment transaction first. func (c *CelerClient) OnChainGetAppChannelBooleanOutcome(cid string, query []byte) (bool, bool, error) { return c.cNode.AppClient.GetBooleanOutcome(cid, query) } - -// OnChainApplyAppChannelAction applies onchain action to a app channel -func (c *CelerClient) OnChainApplyAppChannelAction(cid string, action []byte) error { - return c.cNode.AppClient.ApplyAction(cid, action) -} - -// OnChainFinalizeAppChannelOnActionTimeout finalizes a app channel on action timeout -func (c *CelerClient) OnChainFinalizeAppChannelOnActionTimeout(cid string) error { - return c.cNode.AppClient.FinalizeAppChannelOnActionTimeout(cid) -} - -// OnChainGetAppChannelSettleFinalizedTime gets the onchain settle finalized time -func (c *CelerClient) OnChainGetAppChannelSettleFinalizedTime(cid string) (uint64, error) { - return c.cNode.AppClient.GetAppChannelSettleFinalizedTime(cid) -} - -// OnChainGetAppChannelActionDeadline gets the onchain action deadline -func (c *CelerClient) OnChainGetAppChannelActionDeadline(cid string) (uint64, error) { - return c.cNode.AppClient.GetAppChannelActionDeadline(cid) -} - -// OnChainGetAppChannelSeqNum gets the onchain sequence number -func (c *CelerClient) OnChainGetAppChannelSeqNum(cid string) (uint64, error) { - return c.cNode.AppClient.GetAppChannelSeqNum(cid) -} - -// OnChainGetAppChannelStatus gets the onchain status (0:IDLE, 1:SETTLE, 2:ACTION, 3:FINALIZED) -func (c *CelerClient) OnChainGetAppChannelStatus(cid string) (uint8, error) { - return c.cNode.AppClient.GetAppChannelStatus(cid) -} - -// OnChainGetAppChannelState gets the onchain app state associated with the given key -func (c *CelerClient) OnChainGetAppChannelState(cid string, key *big.Int) ([]byte, error) { - return c.cNode.AppClient.GetAppChannelState(cid, key) -} - -// SettleAppChannelBySigTimeout settle an app channel due to signature timeout -func (c *CelerClient) SettleAppChannelBySigTimeout(cid string, oracleProof []byte) error { - return c.cNode.AppClient.SettleBySigTimeout(cid, oracleProof) -} - -// SettleAppChannelByMoveTimeout settle an app channel due to movement timeout -func (c *CelerClient) SettleAppChannelByMoveTimeout(cid string, oracleProof []byte) error { - return c.cNode.AppClient.SettleByMoveTimeout(cid, oracleProof) -} - -// SettleAppChannelByInvalidTurn settle an app channel due to invalid turn -func (c *CelerClient) SettleAppChannelByInvalidTurn(cid string, oracleProof []byte, cosignedStateProof []byte) error { - return c.cNode.AppClient.SettleByInvalidTurn(cid, oracleProof, cosignedStateProof) -} - -// SettleAppChannelByInvalidState settle an app channel due to invalid state -func (c *CelerClient) SettleAppChannelByInvalidState(cid string, oracleProof []byte, cosignedStateProof []byte) error { - return c.cNode.AppClient.SettleByInvalidState(cid, oracleProof, cosignedStateProof) -} diff --git a/client/celer_client.go b/client/celer_client.go index c8e7c9e..78f1965 100644 --- a/client/celer_client.go +++ b/client/celer_client.go @@ -3,6 +3,7 @@ package client import ( + "context" "errors" "fmt" "math/big" @@ -25,7 +26,6 @@ import ( "github.com/celer-network/agent-pay/utils" "github.com/celer-network/goutils/eth" "github.com/celer-network/goutils/log" - "golang.org/x/net/context" "google.golang.org/protobuf/types/known/anypb" ) @@ -373,13 +373,13 @@ func (c *CelerClient) GetChannelState(tkAddr ctype.Addr) string { } func (c *CelerClient) HasPendingOpenChanRequest(tk *entity.TokenInfo) bool { - blk, found, err := c.dal.GetDestTokenOpenChanBlkNum(c.svrEth, tk) + openedAt, found, err := c.dal.GetDestTokenOpenTs(c.svrEth, tk) if err != nil || !found { // not found, never requested, no pending return false } - curBlk := c.GetCurrentBlockNumberUint64() - if curBlk <= blk+uint64(config.OpenChannelTimeout) { + nowTs := uint64(time.Now().Unix()) + if nowTs <= openedAt+config.OpenChannelTimeout { return true } return false diff --git a/cnode/cnode.go b/cnode/cnode.go index e61ddc8..4f30b6d 100644 --- a/cnode/cnode.go +++ b/cnode/cnode.go @@ -599,13 +599,7 @@ func (c *CNode) initialize( c.dal, c.isOSP) - c.AppClient = app.NewAppClient( - c.nodeConfig, - c.masterTransactor, - c.transactorPool, - c.monitorService, - c.dal, - c.signer) + c.AppClient = app.NewAppClient(c.nodeConfig, c.transactorPool) if c.isMultiServer { c.serverForwarder = c.multiServerForwarder @@ -674,7 +668,8 @@ func (c *CNode) SetDelegation(tokens []ctype.Addr, timeout int64) error { desc := &rpc.DelegationDescription{ Delegator: c.ServerAddr.Bytes(), Delegatee: c.nodeConfig.GetOnChainAddr().Bytes(), - ExpiresAfterBlock: c.monitorService.GetCurrentBlockNumber().Int64() + timeout, + // Field is named ExpiresAfterBlock in the proto for back-compat; value is now a unix timestamp (seconds). + ExpiresAfterBlock: time.Now().Unix() + timeout, TokenToDelegate: delegatedTks, } descBytes, err := proto.Marshal(desc) @@ -766,31 +761,6 @@ func (c *CNode) Close() { } } -// waitTimeout emits a signal to the timeoutChan when the given timeout has passed -func (c *CNode) waitTimeout(ctx context.Context, timeoutChan chan bool, timeout *big.Int) { - queryTicker := time.NewTicker(time.Second) - defer queryTicker.Stop() - currentBlkNum := c.GetCurrentBlockNumber() - deadline := big.NewInt(0) - deadline.Add(currentBlkNum, timeout) - for { - blockNum := c.GetCurrentBlockNumber() - if blockNum.Cmp(deadline) > 0 { - select { - case timeoutChan <- true: - default: - } - return - } - // Wait for the next round. - select { - case <-ctx.Done(): - return - case <-queryTicker.C: - } - } -} - func (c *CNode) GetCurrentBlockNumber() *big.Int { return c.monitorService.GetCurrentBlockNumber() } diff --git a/cnode/cooperativewithdraw/common.go b/cnode/cooperativewithdraw/common.go index 99b36f7..4939a53 100644 --- a/cnode/cooperativewithdraw/common.go +++ b/cnode/cooperativewithdraw/common.go @@ -10,6 +10,7 @@ import ( "math/big" "strings" "sync" + "time" "github.com/celer-network/agent-pay/chain" "github.com/celer-network/agent-pay/chain/channel-eth-go/ledger" @@ -265,8 +266,9 @@ func (p *Processor) updateOnChainBalance( func (p *Processor) checkWithdrawBalanceTx(tx *storage.DALTx, args ...interface{}) error { cid := args[0].(ctype.CidType) withdrawInfo := args[1].(*entity.CooperativeWithdrawInfo) - blkNum := p.monitorService.GetCurrentBlockNumber().Uint64() - balance, err := ledgerview.GetBalanceTx(tx, cid, p.selfAddress, blkNum) + // Withdraw deadlines are unix timestamps (seconds), matching contract `block.timestamp`. + nowTs := uint64(time.Now().Unix()) + balance, err := ledgerview.GetBalanceTx(tx, cid, p.selfAddress, nowTs) if err != nil { log.Error(err) return err @@ -281,7 +283,7 @@ func (p *Processor) checkWithdrawBalanceTx(tx *storage.DALTx, args ...interface{ if !found { return common.ErrChannelNotFound } - if blkNum <= onChainBalance.PendingWithdrawal.Deadline+config.WithdrawTimeoutSafeMargin { + if nowTs <= onChainBalance.PendingWithdrawal.Deadline+config.WithdrawTimeoutSafeMargin { log.Errorln("previous withdraw still pending", onChainBalance.PendingWithdrawal) return errors.New("previous withdraw still pending") } @@ -290,7 +292,7 @@ func (p *Processor) checkWithdrawBalanceTx(tx *storage.DALTx, args ...interface{ withdrawAmt := new(big.Int).SetBytes(withdrawInfo.Withdraw.Amt) receiver := ctype.Bytes2Addr(withdrawInfo.GetWithdraw().GetAccount()) onChainBalance.PendingWithdrawal.Amount = withdrawAmt - onChainBalance.PendingWithdrawal.Deadline = blkNum + config.CooperativeWithdrawTimeout + onChainBalance.PendingWithdrawal.Deadline = nowTs + config.CooperativeWithdrawTimeout onChainBalance.PendingWithdrawal.Receiver = receiver var freeBalance *big.Int if receiver == p.selfAddress { diff --git a/cnode/cooperativewithdraw/proposer.go b/cnode/cooperativewithdraw/proposer.go index 8aaf3bb..22e7723 100644 --- a/cnode/cooperativewithdraw/proposer.go +++ b/cnode/cooperativewithdraw/proposer.go @@ -6,6 +6,7 @@ import ( "bytes" "fmt" "math/big" + "time" "github.com/celer-network/agent-pay/chain" "github.com/celer-network/agent-pay/chain/channel-eth-go/ledger" @@ -104,8 +105,7 @@ func (p *Processor) prepareJob(cid ctype.CidType, amount *big.Int) (*structs.Coo ChannelId: cid[:], SeqNum: newSeqNumUint64, Withdraw: withdraw, - WithdrawDeadline: p.monitorService.GetCurrentBlockNumber().Uint64() + - config.CooperativeWithdrawTimeout, + WithdrawDeadline: uint64(time.Now().Unix()) + config.CooperativeWithdrawTimeout, } serializedInfo, err := proto.Marshal(withdrawInfo) if err != nil { diff --git a/cnode/open_channel.go b/cnode/open_channel.go index d47d9fc..c709a73 100644 --- a/cnode/open_channel.go +++ b/cnode/open_channel.go @@ -187,8 +187,8 @@ func (p *openChannelProcessor) tcbOpenChannel( p.callbacks[ctype.Addr2Hex(tokenAddr)] = openCallback p.callbacksLock.Unlock() } - // deadline according to CORE-622 - initializer.OpenDeadline = p.monitorService.GetCurrentBlockNumber().Uint64() + config.TcbTimeoutInBlockNumber + // deadline according to CORE-622 — unix timestamp (seconds), matching contract `block.timestamp` semantics + initializer.OpenDeadline = uint64(time.Now().Unix()) + config.TcbTimeoutSeconds ocem.ReadableInitializer = utils.PrintChannelInitializer(initializer) initializerBytes, err := proto.Marshal(initializer) if err != nil { @@ -281,7 +281,7 @@ func (p *openChannelProcessor) openChannel( p.callbacks[ctype.Addr2Hex(tokenAddr)] = openCallback p.callbacksLock.Unlock() } - initializer.OpenDeadline = p.monitorService.GetCurrentBlockNumber().Uint64() + config.OpenChannelTimeout + initializer.OpenDeadline = uint64(time.Now().Unix()) + config.OpenChannelTimeout ocem.ReadableInitializer = utils.PrintChannelInitializer(initializer) initializerBytes, err := proto.Marshal(initializer) if err != nil { @@ -698,7 +698,7 @@ func (p *openChannelProcessor) processOpenChannelRequest(req *rpc.OpenChannelReq } ocem.OspToOsp = req.GetOspToOsp() policy, policyErr := RequestStandardDeposit( - p.monitorService.GetCurrentBlockNumber().Uint64(), p.nodeConfig.GetOnChainAddr(), &initializer, req.GetOspToOsp(), ocem) + uint64(time.Now().Unix()), p.nodeConfig.GetOnChainAddr(), &initializer, req.GetOspToOsp(), ocem) if policy&AllowStandardOpenChannel == 0 { return errResp, status.Error(codes.InvalidArgument, "breaks policy:"+policyErr.Error()) } @@ -935,8 +935,8 @@ func (p *openChannelProcessor) emptySimplex( func (p *openChannelProcessor) checkBalanceRefill(cid ctype.CidType, tokenAddr string) error { refillThreshold := rtconfig.GetRefillThreshold(tokenAddr) - blkNum := p.monitorService.GetCurrentBlockNumber().Uint64() - balance, err := ledgerview.GetBalance(p.dal, cid, p.nodeConfig.GetOnChainAddr(), blkNum) + nowTs := uint64(time.Now().Unix()) + balance, err := ledgerview.GetBalance(p.dal, cid, p.nodeConfig.GetOnChainAddr(), nowTs) if err != nil { log.Errorln(err, "unabled to find balance for cid", cid.Hex()) return err @@ -1023,7 +1023,13 @@ func (p *openChannelProcessor) monitorEvent(ledgerContract chain.Contract) { func (p *openChannelProcessor) monitorSingleEvent(ledgerContract chain.Contract, reset bool) { startBlock := p.monitorService.GetCurrentBlockNumber() - endBlock := new(big.Int).Add(startBlock, big.NewInt(int64(config.OpenChannelTimeout))) + // monitor.Config.EndBlock is a block height. OpenChannelTimeout is now seconds, so convert + // seconds to a block count via BlockIntervalSec (seconds-per-block) before adding. + timeoutBlocks := config.OpenChannelTimeout / config.BlockIntervalSec + if timeoutBlocks == 0 { + timeoutBlocks = 1 + } + endBlock := new(big.Int).Add(startBlock, big.NewInt(int64(timeoutBlocks))) monitorCfg := &monitor.Config{ ChainId: config.ChainId.Uint64(), EventName: event.OpenChannel, diff --git a/cnode/pay.go b/cnode/pay.go index 33fcc09..2fa26cc 100644 --- a/cnode/pay.go +++ b/cnode/pay.go @@ -213,7 +213,7 @@ func (c *CNode) SettleExpiredPays(cid ctype.CidType) error { func (c *CNode) getExpiredPays(simplex *entity.SimplexPaymentChannel) ( []*entity.ConditionalPay, []ctype.PayIDType, error) { - currBlock := c.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) var expiredPays []*entity.ConditionalPay var payIDs []ctype.PayIDType for _, payID := range simplex.PendingPayIds.PayIds { @@ -225,7 +225,8 @@ func (c *CNode) getExpiredPays(simplex *entity.SimplexPaymentChannel) ( if !found { return nil, nil, fmt.Errorf("%w: %x", common.ErrPayNotFound, payID) } - if currBlock > pay.ResolveDeadline+config.PaySendTimeoutSafeMargin { + // Deadlines are unix timestamps in seconds. + if nowTs > pay.ResolveDeadline+config.PaySendTimeoutSafeMargin { expiredPays = append(expiredPays, pay) payIDs = append(payIDs, payID) } diff --git a/cnode/policy_engine.go b/cnode/policy_engine.go index b26f890..a7d80f7 100644 --- a/cnode/policy_engine.go +++ b/cnode/policy_engine.go @@ -228,8 +228,11 @@ func getDepositCapacity(nodeConfig common.GlobalNodeConfig, tokenAddr string) (* return balance, nil } +// RequestStandardDeposit checks open-channel policy. nowTs is a unix timestamp (seconds); +// the contract's `OpenDeadline` and rtconfig `MinDeadlineDelta` / `MaxDeadlineDelta` are +// also seconds in the blocktime contracts. func RequestStandardDeposit( - currentBlock uint64, myAddr ctype.Addr, + nowTs uint64, myAddr ctype.Addr, initializer *entity.PaymentChannelInitializer, ospToOsp bool, ocem *pem.OpenChannelEventMessage) (int, error) { noPolicyAllowed := 0 @@ -287,11 +290,11 @@ func RequestStandardDeposit( } // Deadline not big. deadline := initializer.GetOpenDeadline() - if deadline > config.GetMaxDeadlineDelta()+currentBlock { + if deadline > config.GetMaxDeadlineDelta()+nowTs { log.Errorln("deadline too late") return noPolicyAllowed, deadlineOutOfRange } - if deadline < config.GetMinDeadlineDelta()+currentBlock { + if deadline < config.GetMinDeadlineDelta()+nowTs { log.Errorln("deadline too early") return noPolicyAllowed, deadlineOutOfRange } diff --git a/cnode/utils.go b/cnode/utils.go index ad5d340..5a09c09 100644 --- a/cnode/utils.go +++ b/cnode/utils.go @@ -29,8 +29,8 @@ func (c *CNode) GetChannelIdForPeer(peer, tokenAddr ctype.Addr) (ctype.CidType, } func (c *CNode) GetBalance(cid ctype.CidType) (*common.ChannelBalance, error) { - blkNum := c.GetCurrentBlockNumber().Uint64() - return ledgerview.GetBalance(c.dal, cid, c.nodeConfig.GetOnChainAddr(), blkNum) + nowTs := uint64(time.Now().Unix()) + return ledgerview.GetBalance(c.dal, cid, c.nodeConfig.GetOnChainAddr(), nowTs) } // GetJoinStatusForNode gets the join status of an endpoint diff --git a/config/config.go b/config/config.go index 90c6987..0294478 100644 --- a/config/config.go +++ b/config/config.go @@ -4,6 +4,8 @@ package config import ( "math/big" + "os" + "strconv" "time" "github.com/celer-network/agent-pay/common" @@ -12,10 +14,26 @@ import ( "google.golang.org/grpc/keepalive" ) -// NOTE: not protected by lock, only set once at initialization +// envUint returns the env var parsed as a uint64, or def if unset / unparsable. +// Used for the "safe margin" knobs below so e2e tests can shrink production-safe +// 60-second slacks down to a few seconds without recompiling the server binary. +func envUint(key string, def uint64) uint64 { + if v := os.Getenv(key); v != "" { + if n, err := strconv.ParseUint(v, 10, 64); err == nil { + return n + } + } + return def +} + +// NOTE: not protected by lock, only set once at initialization. +// All "*Timeout" / "*Deadline" / "*SafeMargin" values below are in seconds — +// the contracts measure deadlines and challenge windows in `block.timestamp` +// (unix seconds), so off-chain code follows the same unit and comparisons +// against on-chain state stay aligned. var ( ChainId *big.Int - ChannelDisputeTimeout = uint64(10000) + ChannelDisputeTimeout = uint64(86400) // 1 day, seconds BlockDelay = uint64(5) BlockIntervalSec = uint64(10) EventListenerHttp = "" @@ -24,20 +42,24 @@ var ( RouterAliveTimeout = 900 * time.Second OspClearPaysInterval = 613 * time.Second OspReportInverval = 887 * time.Second + + // Safe-margin knobs are env-var tunable so e2e tests can shrink them. Production + // defaults (60s) absorb chain-confirmation slack past a deadline; tests typically + // set CELER_*_SAFE_MARGIN_S=5 to keep the timeout-and-sweep flow snappy. + WithdrawTimeoutSafeMargin = envUint("CELER_WITHDRAW_SAFE_MARGIN_S", 60) // seconds + PaySendTimeoutSafeMargin = envUint("CELER_PAY_SEND_SAFE_MARGIN_S", 60) // seconds + PayRecvTimeoutSafeMargin = envUint("CELER_PAY_RECV_SAFE_MARGIN_S", 60) // seconds ) const ( ClientCacheSize = 1000 ServerCacheSize = 16 - OpenChannelTimeout = uint64(100) - CooperativeWithdrawTimeout = uint64(10) - WithdrawTimeoutSafeMargin = uint64(6) // TODO: this should be profile.blockdelay + margin - PayResolveTimeout = uint64(10) - PaySendTimeoutSafeMargin = uint64(6) - PayRecvTimeoutSafeMargin = uint64(4) - AdminSendTokenTimeout = uint64(50) - QuickCatchBlockDelay = uint64(2) - TcbTimeoutInBlockNumber = 576000 + OpenChannelTimeout = uint64(600) // seconds + CooperativeWithdrawTimeout = uint64(60) // seconds + PayResolveTimeout = uint64(60) // seconds (on-chain partial-resolve challenge window) + AdminSendTokenTimeout = uint64(600) // seconds + QuickCatchBlockDelay = uint64(2) // blocks (unrelated to deadlines — fast-path reorg confirmation) + TcbTimeoutSeconds = uint64(604800) // 7 days, seconds // Protocol Version in AuthReq, >=1 support sync AuthProtocolVersion = uint64(1) diff --git a/delegate/delegate.go b/delegate/delegate.go index 5901865..22d1f79 100644 --- a/delegate/delegate.go +++ b/delegate/delegate.go @@ -4,6 +4,7 @@ package delegate import ( "math/big" + "time" "github.com/celer-network/agent-pay/common" "github.com/celer-network/agent-pay/common/structs" @@ -19,7 +20,6 @@ import ( type delegateProcess interface { AddBooleanPay(pay *entity.ConditionalPay, note *anypb.Any, dstNetId uint64) (ctype.PayIDType, error) - GetCurrentBlockNumber() *big.Int } type DelegateManager struct { @@ -151,7 +151,7 @@ func (m *DelegateManager) sendToken(dst ctype.Addr, lumpsum *lumpSum) error { LogicType: entity.TransferFunctionType_BOOLEAN_AND, MaxTransfer: transfer, }, - ResolveDeadline: m.process.GetCurrentBlockNumber().Uint64() + config.AdminSendTokenTimeout, + ResolveDeadline: uint64(time.Now().Unix()) + config.AdminSendTokenTimeout, ResolveTimeout: config.PayResolveTimeout, } diff --git a/deploy/mainnet/rt_config.json b/deploy/mainnet/rt_config.json index b861c6c..a675482 100644 --- a/deploy/mainnet/rt_config.json +++ b/deploy/mainnet/rt_config.json @@ -9,13 +9,13 @@ "min_deposit": "50000000000000000", "max_deposit": "2000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 600 + "max_deadline_delta": 7200 }, "4f9254c83eb525f9fcf346490bbb3ed28a81c667": { "min_deposit": "500000000000000000000", "max_deposit": "100000000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 600 + "max_deadline_delta": 7200 } } } diff --git a/deploy/ropsten/rt_config.json b/deploy/ropsten/rt_config.json index 54b0295..9c016e8 100644 --- a/deploy/ropsten/rt_config.json +++ b/deploy/ropsten/rt_config.json @@ -3,21 +3,21 @@ "open_chan_wait_s": 5, "min_gas_gwei": 2, "max_gas_gwei": 30, - "max_dispute_timeout": 20000, - "min_dispute_timeout": 5, + "max_dispute_timeout": 259200, + "min_dispute_timeout": 43200, "standard_configs": { "config": { "0000000000000000000000000000000000000000": { "min_deposit": "50000000000000000", "max_deposit": "2000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 600 + "max_deadline_delta": 7200 }, "e496fa48419c14b0fe2dcf9c1d5c0f408ba3bd2d": { "min_deposit": "500000000000000000000", "max_deposit": "100000000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 600 + "max_deadline_delta": 7200 } } } diff --git a/dispute/dispute_channel.go b/dispute/dispute_channel.go index 637328e..8d8cf00 100644 --- a/dispute/dispute_channel.go +++ b/dispute/dispute_channel.go @@ -180,12 +180,14 @@ func (p *Processor) ConfirmSettlePaymentChannel(cid ctype.CidType, waitMined boo if state != enums.ChanState_SETTLING { return fmt.Errorf("invalid channel %x state %s", cid, fsm.ChanStateName(state)) } - blkNum := p.monitorService.GetCurrentBlockNumber() - finalizedBlknum, err := ledgerview.GetOnChainSettleFinalizedTime(cid, p.nodeConfig) + // settleFinalizedTime is now a unix timestamp (seconds), per the contract's + // `block.timestamp`-based settlement semantics. + nowTs := uint64(time.Now().Unix()) + finalizedTs, err := ledgerview.GetOnChainSettleFinalizedTime(cid, p.nodeConfig) if err != nil { return fmt.Errorf("GetOnChainSettleFinalizedTime err: %w", err) } - if blkNum.Uint64() < finalizedBlknum.Uint64() { + if nowTs < finalizedTs.Uint64() { return fmt.Errorf("channel %x not finalized yet", cid) } if waitMined { diff --git a/dispute/dispute_payment.go b/dispute/dispute_payment.go index c58b0bb..10a7c4d 100644 --- a/dispute/dispute_payment.go +++ b/dispute/dispute_payment.go @@ -5,6 +5,7 @@ package dispute import ( "fmt" "math/big" + "time" "github.com/celer-network/agent-pay/chain" "github.com/celer-network/agent-pay/chain/channel-eth-go/payregistry" @@ -56,7 +57,7 @@ func (p *Processor) resolvePaymentByConditions(payID ctype.PayIDType) error { // return nli if payment is already resolved to max return nil } - if pay.ResolveDeadline < p.monitorService.GetCurrentBlockNumber().Uint64() { + if pay.ResolveDeadline < uint64(time.Now().Unix()) { log.Errorln(common.ErrDeadlinePassed, "pay:", utils.PrintConditionalPay(pay)) return common.ErrDeadlinePassed } diff --git a/dispute/dispute_withdraw.go b/dispute/dispute_withdraw.go index ffe3ece..89cf1d7 100644 --- a/dispute/dispute_withdraw.go +++ b/dispute/dispute_withdraw.go @@ -6,6 +6,7 @@ import ( "bytes" "fmt" "math/big" + "time" "github.com/celer-network/agent-pay/chain" "github.com/celer-network/agent-pay/chain/channel-eth-go/ledger" @@ -41,8 +42,8 @@ func (p *Processor) IntendWithdraw(cidFrom ctype.CidType, amount *big.Int, cidTo return fmt.Errorf("previous withdraw still pending") } - blkNum := p.monitorService.GetCurrentBlockNumber().Uint64() - balance, err := ledgerview.GetBalance(p.dal, cidFrom, p.nodeConfig.GetOnChainAddr(), blkNum) + nowTs := uint64(time.Now().Unix()) + balance, err := ledgerview.GetBalance(p.dal, cidFrom, p.nodeConfig.GetOnChainAddr(), nowTs) if err != nil { log.Error(err) return err @@ -93,7 +94,8 @@ func (p *Processor) ConfirmWithdraw(cid ctype.CidType) error { log.Error("GetOnChainDisputeTimeout failed", err) return err } - if p.monitorService.GetCurrentBlockNumber().Uint64() < requestTime+disputeTimeout { + // requestTime and disputeTimeout are unix-second values from the contract. + if uint64(time.Now().Unix()) < requestTime+disputeTimeout { err2 := fmt.Errorf("withdraw disput timeout not reached") log.Error(err2) return err2 diff --git a/docs/backend-implementation.md b/docs/backend-implementation.md index e50285e..b2a7edd 100644 --- a/docs/backend-implementation.md +++ b/docs/backend-implementation.md @@ -84,7 +84,7 @@ See [server/server.go](../server/server.go) and [common/profile.go](../common/pr 5. Start the watch service and monitor service. 6. Construct the global node config with contract ABIs and addresses. 7. Start route control for OSP mode. -8. Start processors for deposits, open-channel, cooperative withdraw, disputes, app sessions, and channel migration. +8. Start processors for deposits, open-channel, cooperative withdraw, disputes, app channels (registration + on-chain outcome query), and channel migration. 9. Create the `Messager` and `CelerMsgDispatcher`. 10. Start the periodic OSP cleanup routine. @@ -114,7 +114,7 @@ The optional OSP WebAPI listener is intentionally narrower than the client-node | [storage](../storage) | SQLite or SQL-backed persistence plus the DAL transaction boundary used by protocol handlers | | [deposit](../deposit) | Asynchronous deposit-job processing and batching | | [dispute](../dispute) | On-chain fallback for payment/channel disputes and registry queries | -| [app](../app) | App-session support for virtual/deployed app logic that feeds payment conditions | +| [app](../app) | Bindings for the `IBooleanCond` condition-contract interface (`agent-pay-contracts/src/lib/interface/IBooleanCond.sol`) plus `AppClient` — registration of `VIRTUAL_CONTRACT` bytecode, lazy on-chain deployment via `VirtContractResolver`, and off-chain `IBooleanCond.{isFinalized,getOutcome}` query. Stateless: no session state machine, no oracle disputes | | [client](../client) | Go client wrapper around `CNode` for edge/client nodes | | [celersdk](../celersdk) | Higher-level SDK interface intended for app/mobile integration | | [chain](../chain) and [ledgerview](../ledgerview) | Contract bindings and read helpers for on-chain state | @@ -131,7 +131,6 @@ Message and admin contracts live under [proto](../proto) and [webapi/proto](../w | [proto/rpc.proto](../proto/rpc.proto) | `Rpc` service: `CelerStream` (bidirectional streaming peer transport) and the public `WebApi` service | | [proto/osp_admin.proto](../proto/osp_admin.proto) | Admin gRPC: stream registration, `OpenChannel`, `Deposit`, `SendToken`, `CooperativeSettle` | | [proto/multiserver.proto](../proto/multiserver.proto) | `MultiServer` gRPC used in shared-database, multi-server deployments | -| [proto/app.proto](../proto/app.proto) | App-session messaging used by the virtual-app layer | | [proto/chain.proto](../proto/chain.proto) | Shared on-chain entity encodings used by handlers and storage | | [proto/osp_report.proto](../proto/osp_report.proto) | Periodic OSP reporting payloads consumed by the explorer | | [webapi/proto/web_api.proto](../webapi/proto/web_api.proto) | Pay-centric WebAPI used by client nodes and the optional `-webapigrpc` listener | @@ -244,6 +243,8 @@ The controller in [route/controller.go](../route/controller.go) does the OSP-spe - Broadcast routing updates to peer OSPs - Report OSP info to the explorer when configured +The `RouterRegistry` contract stores `block.timestamp` (unix seconds) per registered router, so the off-chain liveness thresholds (`refreshIntervalSec = 5 days`, `expireTimeoutSec = 7 days`) are also in seconds. Comparisons use `time.Now().Unix()`, not the chain block height. + This matches the protocol goal that relay nodes should stay simple in payment handling while still maintaining a network-level routing view. ## Storage and Transaction Boundaries diff --git a/docs/backend-troubleshooting.md b/docs/backend-troubleshooting.md index eaa2157..1cbbd45 100644 --- a/docs/backend-troubleshooting.md +++ b/docs/backend-troubleshooting.md @@ -327,7 +327,7 @@ Checks: 1. Validate the receiver and token addresses before retrying. 2. Confirm the stream and route exist. -3. Confirm the current block height and `rtconfig` payment-timeout settings are consistent with the send path. +3. Confirm wall-clock time and `rtconfig` payment-timeout settings are consistent with the send path. Pay deadlines are unix timestamps (seconds) since the contracts switched to `block.timestamp`-based windows; off-chain code uses `time.Now().Unix()` and the `rtconfig.MaxPaymentTimeout` cap is also in seconds. 4. Confirm the destination is reachable on the intended network. ### Symptom: receive-side logs show `invalid sequence number` diff --git a/docs/backend-usage.md b/docs/backend-usage.md index c5d29ed..9f46a9d 100644 --- a/docs/backend-usage.md +++ b/docs/backend-usage.md @@ -314,6 +314,22 @@ Examples: - [testing/profile/rt_config_multiosp.json](../testing/profile/rt_config_multiosp.json) - [test/manual/rt_config.json](../test/manual/rt_config.json) +### Deadline and timeout units + +The on-chain contracts use `block.timestamp` (unix seconds) for every challenge window, dispute timeout, and deadline (`disputeTimeout`, `settleFinalizedTime`, `withdrawDeadline`, `openDeadline`, `resolveDeadline`, `resolveTimeout`, `migrationDeadline`, plus the `RouterRegistry` register/refresh value). Off-chain code follows the same unit, so all of the following are seconds: + +- profile `DisputeTimeout` (challenge window applied to each opened channel) +- rtconfig `min_dispute_timeout` / `max_dispute_timeout` / `max_payment_timeout` +- per-token rtconfig `min_deadline_delta` / `max_deadline_delta` (open-channel policy) +- `config.OpenChannelTimeout`, `CooperativeWithdrawTimeout`, `PayResolveTimeout`, `AdminSendTokenTimeout`, `TcbTimeoutSeconds` +- env-var safe-margin knobs (`CELER_PAY_RECV_SAFE_MARGIN_S`, `CELER_PAY_SEND_SAFE_MARGIN_S`, `CELER_WITHDRAW_SAFE_MARGIN_S`, default `60` each) + +When tuning rtconfig for a new chain, retune in seconds — not blocks. There is no implicit blocks-per-second multiplier in the off-chain code. + +#### Test environment overrides + +The e2e test harness sets `CELER_*_SAFE_MARGIN_S=5` in `TestMain` so the timeout-and-sweep flow runs in seconds instead of minutes. Production deployments should leave these unset (default `60`). + ## Server Flags That Matter Most | Flag | Meaning | diff --git a/entity/entity.pb.go b/entity/entity.pb.go index e087c6b..15747d9 100644 --- a/entity/entity.pb.go +++ b/entity/entity.pb.go @@ -1,4 +1,4 @@ -// Copyright 2018-2025 Celer Network +// Copyright 2018-2026 Celer Network // Code generated by protoc-gen-go. DO NOT EDIT. // versions: @@ -403,7 +403,7 @@ type SimplexPaymentChannel struct { TransferToPeer *TokenTransfer `protobuf:"bytes,4,opt,name=transfer_to_peer,json=transferToPeer,proto3" json:"transfer_to_peer,omitempty"` // head of the idlist chain of all pending conditional pays. PendingPayIds *PayIdList `protobuf:"bytes,5,opt,name=pending_pay_ids,json=pendingPayIds,proto3" json:"pending_pay_ids,omitempty"` - // The last resolve deadline of all pending conditonal pays. + // The last resolve deadline of all pending conditional pays. // confirmSettle must be called after all pending pays have been finalized, // namely all pending pays have been resolved in the pay registry, // or after the last_pay_resolve_deadline. @@ -626,7 +626,7 @@ type ConditionalPay struct { // transfer_func.max_transfer.receiver.account is not needed for unicast payment TransferFunc *TransferFunction `protobuf:"bytes,5,opt,name=transfer_func,json=transferFunc,proto3" json:"transfer_func,omitempty"` // resolve_deadline is the deadline for a cond_pay to be resolved on chain in the - // pay resgistry by either condition or vouched results, and the payment result + // pay registry by either condition or vouched results, and the payment result // is finalized after resolve_deadline. // Payment channel peers should apply a safe_margin for off-chain processing, // i.e., should take dispute action before [resolve_deadline - safe_margin] diff --git a/handlers/msghdl/handle_cond_pay_receipt.go b/handlers/msghdl/handle_cond_pay_receipt.go index c9a7431..2b23015 100644 --- a/handlers/msghdl/handle_cond_pay_receipt.go +++ b/handlers/msghdl/handle_cond_pay_receipt.go @@ -6,6 +6,7 @@ import ( "bytes" "errors" "fmt" + "time" "github.com/celer-network/agent-pay/common" enums "github.com/celer-network/agent-pay/common/structs" @@ -143,7 +144,8 @@ func (h *CelerMsgHandler) verifyDelegationProof( if !hashlist.Exist(description.GetTokenToDelegate(), tokenAddr.Bytes()) { return errors.New("token type not approved by destination to be delegated") } - if description.GetExpiresAfterBlock() < h.monitorService.GetCurrentBlockNumber().Int64() { + // ExpiresAfterBlock is now a unix timestamp (seconds); field name kept for wire-format back-compat. + if description.GetExpiresAfterBlock() < time.Now().Unix() { return errors.New("description expired") } if !eth.IsSignatureValid(ctype.Bytes2Addr(description.GetDelegator()), payBytes, receipt.GetPayDelegatorSig()) { diff --git a/handlers/msghdl/handle_cond_pay_request.go b/handlers/msghdl/handle_cond_pay_request.go index aaafdf1..4744183 100644 --- a/handlers/msghdl/handle_cond_pay_request.go +++ b/handlers/msghdl/handle_cond_pay_request.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "math/big" + "time" "github.com/celer-network/agent-pay/common" "github.com/celer-network/agent-pay/common/structs" @@ -26,7 +27,7 @@ import ( "google.golang.org/protobuf/proto" ) -const onchainCheckInterval = 5 +const onchainCheckInterval = 60 // seconds between on-chain balance re-syncs func (h *CelerMsgHandler) HandleCondPayRequest(frame *common.MsgFrame) error { if frame.Message.GetCondPayRequest() == nil { @@ -178,14 +179,14 @@ func (h *CelerMsgHandler) processCondPayRequest( return common.ErrInvalidPaySrc // pay src is myself } - // verify payment deadline is within limit - blknum := h.monitorService.GetCurrentBlockNumber().Uint64() - if pay.GetResolveDeadline() > blknum+rtconfig.GetMaxPaymentTimeout() { + // verify payment deadline is within limit (deadlines are unix timestamps in seconds) + nowTs := uint64(time.Now().Unix()) + if pay.GetResolveDeadline() > nowTs+rtconfig.GetMaxPaymentTimeout() { if seqErr := h.checkSeqNum(request, cid, recvdSimplex, logEntry); seqErr != nil { return seqErr } // should not happen if peer has the same config - return fmt.Errorf("%w, deadline %d current %d", common.ErrInvalidPayDeadline, pay.GetResolveDeadline(), blknum) + return fmt.Errorf("%w, deadline %d now %d", common.ErrInvalidPayDeadline, pay.GetResolveDeadline(), nowTs) } var routeLoop bool err := h.dal.Transactional( @@ -406,33 +407,34 @@ func (h *CelerMsgHandler) verifyCommonPayRequest( return common.ErrInvalidSeqNum // packet loss } - // verify balance - blkNum := h.monitorService.GetCurrentBlockNumber().Uint64() + // verify balance — nowTs is a unix timestamp (seconds) used for both ComputeBalance's + // pending-withdraw check and on-chain re-sync rate limiting (PutQueryTime stores seconds too). + nowTs := uint64(time.Now().Unix()) balance := ledgerview.ComputeBalance( - selfSimplex, storedSimplex, onChainBalance, h.nodeConfig.GetOnChainAddr(), peer, blkNum) + selfSimplex, storedSimplex, onChainBalance, h.nodeConfig.GetOnChainAddr(), peer, nowTs) recvdAmt := new(big.Int).SetBytes(pay.GetTransferFunc().GetMaxTransfer().GetReceiver().GetAmt()) if recvdAmt.Cmp(balance.PeerFree) == 1 { if !h.isOSP { - lastSyncBlk, _ := tx.GetQueryTime(config.QueryName_OnChainBalance) - if blkNum-lastSyncBlk > onchainCheckInterval { + lastSyncTs, _ := tx.GetQueryTime(config.QueryName_OnChainBalance) + if nowTs-lastSyncTs > onchainCheckInterval { log.Warnf("channel %x balance not enough, try sync with onchain balance once", cid) var err error onChainBalance, err = ledgerview.SyncOnChainBalanceTx(tx, cid, h.nodeConfig) if err != nil { log.Error(err) } else { - err = tx.PutQueryTime(config.QueryName_OnChainBalance, blkNum) + err = tx.PutQueryTime(config.QueryName_OnChainBalance, nowTs) if err != nil { log.Error(err) } balance = ledgerview.ComputeBalance( - selfSimplex, storedSimplex, onChainBalance, h.nodeConfig.GetOnChainAddr(), peer, blkNum) + selfSimplex, storedSimplex, onChainBalance, h.nodeConfig.GetOnChainAddr(), peer, nowTs) if recvdAmt.Cmp(balance.PeerFree) != 1 { return nil } } } else { - log.Warnf("channel %x balance not enough, last sycned onchain balance at blk %d", cid, lastSyncBlk) + log.Warnf("channel %x balance not enough, last synced onchain balance at unix ts %d", cid, lastSyncTs) } } @@ -638,9 +640,10 @@ func (h *CelerMsgHandler) checkPayDelegable( } token := pay.GetTransferFunc().GetMaxTransfer().GetToken().GetTokenAddress() + // ExpiresAfterBlock is now a unix timestamp (seconds); field name kept for wire-format back-compat. delegable := ctype.Bytes2Addr(description.GetDelegatee()) == dest && hashlist.Exist(description.GetTokenToDelegate(), token) && - description.GetExpiresAfterBlock() > h.monitorService.GetCurrentBlockNumber().Int64() + description.GetExpiresAfterBlock() > time.Now().Unix() return delegable, proof, description } @@ -689,7 +692,7 @@ func (h *CelerMsgHandler) crossNetPayInbound( newPay.TransferFunc.MaxTransfer.Token = localToken } // TODO: update resolve dealine and timeout, check conditions - newPay.ResolveDeadline = h.monitorService.GetCurrentBlockNumber().Uint64() + xnet.GetTimeout() + newPay.ResolveDeadline = uint64(time.Now().Unix()) + xnet.GetTimeout() newPay.ResolveTimeout = config.PayResolveTimeout newPay.PayResolver = h.nodeConfig.GetPayResolverContract().GetAddr().Bytes() newPayID := ctype.Pay2PayID(newPay) diff --git a/handlers/msghdl/handle_pay_settle_request.go b/handlers/msghdl/handle_pay_settle_request.go index 13b832f..8366be8 100644 --- a/handlers/msghdl/handle_pay_settle_request.go +++ b/handlers/msghdl/handle_pay_settle_request.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "math/big" + "time" "github.com/celer-network/agent-pay/common" "github.com/celer-network/agent-pay/common/structs" @@ -330,7 +331,7 @@ func (h *CelerMsgHandler) processPaySettleRequestTx(tx *storage.DALTx, args ...i } case rpc.PaymentSettleReason_PAY_EXPIRED: - curblkNum := h.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) for _, pi := range payInfos { h.checkPayRouteLoop(cid, pi) if pi.routeLoop { @@ -346,10 +347,10 @@ func (h *CelerMsgHandler) processPaySettleRequestTx(tx *storage.DALTx, args ...i // 4. pay has egress state other than CoSignedCanceled, and has resolved onchain with non-zero amount payID := ctype.Bytes2PayID(pi.req.GetSettledPayId()) - // verify pay already expired - if curblkNum < pi.pay.GetResolveDeadline()+config.PayRecvTimeoutSafeMargin { + // verify pay already expired (deadlines are unix timestamps in seconds) + if nowTs < pi.pay.GetResolveDeadline()+config.PayRecvTimeoutSafeMargin { log.Errorln(common.ErrInvalidSettleReason, - "deadline", pi.pay.GetResolveDeadline(), curblkNum) + "deadline", pi.pay.GetResolveDeadline(), nowTs) return common.ErrInvalidSettleReason // should not happen if peer follows the same protocol } diff --git a/ledgerview/localview.go b/ledgerview/localview.go index 2ec6f12..c9508b2 100644 --- a/ledgerview/localview.go +++ b/ledgerview/localview.go @@ -18,23 +18,26 @@ import ( "google.golang.org/protobuf/proto" ) -func GetBalance(dal *storage.DAL, cid ctype.CidType, myAddr ctype.Addr, blkNum uint64) (*common.ChannelBalance, error) { +// GetBalance computes the channel balance. nowTs is a unix timestamp (seconds) used to +// decide whether a pending withdrawal is still active per the contract's +// `block.timestamp`-based deadline semantics. +func GetBalance(dal *storage.DAL, cid ctype.CidType, myAddr ctype.Addr, nowTs uint64) (*common.ChannelBalance, error) { var balance *common.ChannelBalance - err := dal.Transactional(getBalanceTx, cid, myAddr, blkNum, &balance) + err := dal.Transactional(getBalanceTx, cid, myAddr, nowTs, &balance) return balance, err } func getBalanceTx(tx *storage.DALTx, args ...interface{}) error { cid := args[0].(ctype.CidType) myAddr := args[1].(ctype.Addr) - blkNum := args[2].(uint64) + nowTs := args[2].(uint64) balance := args[3].(**common.ChannelBalance) - bal, err := GetBalanceTx(tx, cid, myAddr, blkNum) + bal, err := GetBalanceTx(tx, cid, myAddr, nowTs) *balance = bal return err } -func GetBalanceTx(tx *storage.DALTx, cid ctype.CidType, myAddr ctype.Addr, blkNum uint64) (*common.ChannelBalance, error) { +func GetBalanceTx(tx *storage.DALTx, cid ctype.CidType, myAddr ctype.Addr, nowTs uint64) (*common.ChannelBalance, error) { peer, onChainBalance, baseSeq, lastAckedSeq, selfSimplex, peerSimplex, found, err := tx.GetChanForBalance(cid) if err != nil { return nil, fmt.Errorf("GetChanForBalance err: %w", err) @@ -47,7 +50,7 @@ func GetBalanceTx(tx *storage.DALTx, cid ctype.CidType, myAddr ctype.Addr, blkNu return nil, fmt.Errorf("GetBaseSimplex err: %w", err) } - balance := ComputeBalance(mySimplex, peerSimplex, onChainBalance, myAddr, peer, blkNum) + balance := ComputeBalance(mySimplex, peerSimplex, onChainBalance, myAddr, peer, nowTs) return balance, nil } @@ -81,11 +84,13 @@ func GetBaseSimplex( return selfSimplex, nil } +// ComputeBalance derives free / locked channel balance. nowTs is a unix timestamp +// (seconds) used to evaluate the active-pending-withdraw deadline window. func ComputeBalance( selfSimplex, peerSimplex *entity.SimplexPaymentChannel, onChainBalance *structs.OnChainBalance, myAddr, peerAddr ctype.Addr, - blkNum uint64) *common.ChannelBalance { + nowTs uint64) *common.ChannelBalance { myLockedAmt := new(big.Int).SetBytes(selfSimplex.TotalPendingAmount) toPeerAmt := utils.BytesToBigInt(selfSimplex.TransferToPeer.Receiver.Amt) @@ -105,7 +110,8 @@ func ComputeBalance( peerFree.Sub(peerFree, fromPeerAmt) peerFree.Sub(peerFree, peerLockedAmt) - if blkNum <= onChainBalance.PendingWithdrawal.Deadline+config.WithdrawTimeoutSafeMargin { + // Pending-withdraw deadline is now a unix timestamp (seconds). + if nowTs <= onChainBalance.PendingWithdrawal.Deadline+config.WithdrawTimeoutSafeMargin { if onChainBalance.PendingWithdrawal.Receiver == myAddr { myFree.Sub(myFree, onChainBalance.PendingWithdrawal.Amount) } else { diff --git a/messager/send_cond_pay_request.go b/messager/send_cond_pay_request.go index daa77ee..8b94faa 100644 --- a/messager/send_cond_pay_request.go +++ b/messager/send_cond_pay_request.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "math/big" + "time" "github.com/celer-network/agent-pay/common" enums "github.com/celer-network/agent-pay/common/structs" @@ -177,10 +178,10 @@ func (m *Messager) sendCondPayRequest( return common.ErrInvalidPayDst } - // verify payment deadline is within limit - blknum := m.monitorService.GetCurrentBlockNumber().Uint64() - if pay.GetResolveDeadline() > blknum+rtconfig.GetMaxPaymentTimeout() { - return fmt.Errorf("%w, deadline %d current %d", common.ErrInvalidPayDeadline, pay.GetResolveDeadline(), blknum) + // verify payment deadline is within limit (deadlines are unix timestamps in seconds) + nowTs := uint64(time.Now().Unix()) + if pay.GetResolveDeadline() > nowTs+rtconfig.GetMaxPaymentTimeout() { + return fmt.Errorf("%w, deadline %d now %d", common.ErrInvalidPayDeadline, pay.GetResolveDeadline(), nowTs) } var seqnum uint64 @@ -238,9 +239,9 @@ func (m *Messager) runCondPayTx(tx *storage.DALTx, args ...interface{}) error { return fmt.Errorf("GetBaseSimplex err %w", err) } - blkNum := m.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) balance := ledgerview.ComputeBalance( - workingSimplex, peerSimplex, onChainBalance, m.nodeConfig.GetOnChainAddr(), peer, blkNum) + workingSimplex, peerSimplex, onChainBalance, m.nodeConfig.GetOnChainAddr(), peer, nowTs) sendAmt := new(big.Int).SetBytes(pay.GetTransferFunc().GetMaxTransfer().GetReceiver().GetAmt()) // OSP refill if free balance is below threshold if m.isOSP && chanState == enums.ChanState_OPENED { @@ -400,7 +401,7 @@ func (m *Messager) sendCrossNetPay( return fmt.Errorf("InsertCrossNetPay err: %w", err) } - xnet.Timeout = pay.ResolveDeadline - m.monitorService.GetCurrentBlockNumber().Uint64() + xnet.Timeout = pay.ResolveDeadline - uint64(time.Now().Unix()) request := &rpc.CondPayRequest{ CondPay: payBytes, Note: note, diff --git a/migrate/migrate_channel.go b/migrate/migrate_channel.go index ca98409..cb7c126 100644 --- a/migrate/migrate_channel.go +++ b/migrate/migrate_channel.go @@ -7,6 +7,7 @@ import ( "context" "errors" "fmt" + "time" "github.com/celer-network/agent-pay/chain" "github.com/celer-network/agent-pay/chain/channel-eth-go/ledger" @@ -27,8 +28,8 @@ import ( ) const ( - chanMigrationDeadline uint64 = uint64(365 * 24 * 60 * 60 / 13) // estimation of block numbers produced in one year - chanMigrationInterval uint64 = uint64(30 * 24 * 60 * 60 / 13) // estimation of block numbers produced in one month + chanMigrationDeadline uint64 = 365 * 24 * 60 * 60 // 1 year, seconds + chanMigrationInterval uint64 = 30 * 24 * 60 * 60 // 1 month, seconds — tolerance window before the deadline // migration state for channel MigrationStateInitialized int = 0 @@ -110,25 +111,25 @@ func (p *MigrateChannelProcessor) checkChannelMigration(peer ctype.Addr, cid cty return nil } - currentBlk := p.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) deadline, state, _, found, err := p.dal.GetChanMigration(cid, latestLedgerAddr) if err != nil { return fmt.Errorf("Fail to get channel(%x) migration info: %w", cid, err) } // if migration info already exists and state is submitted or deadline is still valid - if found && (state == MigrationStateSubmitted || deadline > currentBlk) { + if found && (state == MigrationStateSubmitted || deadline > nowTs) { return nil } // if no migration info found for channel, // then we need to begin migration initialization log.Infof("Start migrating channel: %x for peer: %x", cid, peer) - deadline = currentBlk + chanMigrationDeadline + deadline = nowTs + chanMigrationDeadline migrationInfo := &entity.ChannelMigrationInfo{ ChannelId: cid.Bytes(), FromLedgerAddress: currentLedger.Bytes(), ToLedgerAddress: latestLedgerAddr.Bytes(), - MigrationDeadline: currentBlk + chanMigrationDeadline, + MigrationDeadline: nowTs + chanMigrationDeadline, } migrationInfoBytes, err := proto.Marshal(migrationInfo) @@ -214,10 +215,10 @@ func (p *MigrateChannelProcessor) ProcessMigrateChannelRequest(req *rpc.MigrateC return nil, errors.New("inconsistent config ledger info") } - currentBlk := p.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) deadline := migrationInfo.GetMigrationDeadline() - if currentBlk+chanMigrationInterval >= deadline { // have a tolerant range for deadline - log.Errorf("Channel migration deadline check failed: current(%d), deadline(%d)", currentBlk, deadline) + if nowTs+chanMigrationInterval >= deadline { // have a tolerant range for deadline + log.Errorf("Channel migration deadline check failed: now(%d), deadline(%d)", nowTs, deadline) return nil, common.ErrDeadlinePassed } diff --git a/proto/app.proto b/proto/app.proto deleted file mode 100644 index 2fc453b..0000000 --- a/proto/app.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-2025 Celer Network - -syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/app"; -import "google/protobuf/descriptor.proto"; -package app; - -extend google.protobuf.FieldOptions { - string soltype = 1003; -} - -// Next Tag: 5 -message AppState { - // nonce should be unique for each app session among the same signers - uint64 nonce = 1 [(soltype) = "uint"]; - // for each nonce, new state has higher sequence number - uint64 seq_num = 2 [(soltype) = "uint"]; - // app specific state - bytes state = 3; - // on-chain response (settle, action) timeout - uint64 timeout = 4 [(soltype) = "uint"]; -} - -// Next Tag: 3 -message StateProof { - // serialized AppState - bytes app_state = 1; - repeated bytes sigs = 2; -} - -// used for multi-session app -// Next Tag: 3 -message SessionQuery { - // session ID - bytes session = 1 [(soltype) = "bytes32"]; - // query related to the specified session - bytes query = 2; -} diff --git a/proto/chain.proto b/proto/chain.proto index 3139a91..48ad1e9 100644 --- a/proto/chain.proto +++ b/proto/chain.proto @@ -1,10 +1,11 @@ -// Copyright 2018-2025 Celer Network +// Copyright 2018-2026 Celer Network syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/chain"; package chain; +option go_package = "github.com/celer-network/agent-pay/chain"; + // Next Tag: 3 message OpenChannelRequest { // serialized entity.PaymentChannelInitializer message @@ -48,12 +49,12 @@ message SignedSimplexState { // Next Tag: 2 // Using this message to intendSettle is flexible: // * you can put multiple signed simplex states in one array as long as not exceeding gas limit -// * you can put signed simplex states of multiple channels in one array +// * you can put signed simplex states of multiple channels in one array // to intendSettle these channels in one function call // How to use: // * channelIds of these simplex states must be ascending // * non-null simplex states should be cosigned by both peers of the channel -// * null simplex states should set seqNum as 0 and be signed by +// * null simplex states should set seqNum as 0 and be signed by // exactly one of the peers of the channel // Note: if you are submitting one simplex state of the duplex channel, // you are intending to settle the whole duplex channel. diff --git a/proto/entity.proto b/proto/entity.proto index 567553b..aca6b94 100644 --- a/proto/entity.proto +++ b/proto/entity.proto @@ -1,11 +1,12 @@ -// Copyright 2018-2025 Celer Network +// Copyright 2018-2026 Celer Network syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/entity"; + +package entity; import "google/protobuf/descriptor.proto"; -package entity; +option go_package = "github.com/celer-network/agent-pay/entity"; extend google.protobuf.FieldOptions { string soltype = 1001; @@ -51,7 +52,7 @@ message SimplexPaymentChannel { TokenTransfer transfer_to_peer = 4; // head of the idlist chain of all pending conditional pays. PayIdList pending_pay_ids = 5; - // The last resolve deadline of all pending conditonal pays. + // The last resolve deadline of all pending conditional pays. // confirmSettle must be called after all pending pays have been finalized, // namely all pending pays have been resolved in the pay registry, // or after the last_pay_resolve_deadline. @@ -62,11 +63,11 @@ message SimplexPaymentChannel { // Next Tag: 3 message PayIdList { - // array of ids of serialized ConditionalPay - // pay_id is computed as hash(hash(cond_pay), pay_resolver_address) - repeated bytes pay_ids = 1 [(soltype) = "bytes32"]; - // hash of serialized next PayIdList - bytes next_list_hash = 2 [(soltype) = "bytes32"]; + // array of ids of serialized ConditionalPay + // pay_id is computed as hash(hash(cond_pay), pay_resolver_address) + repeated bytes pay_ids = 1 [(soltype) = "bytes32"]; + // hash of serialized next PayIdList + bytes next_list_hash = 2 [(soltype) = "bytes32"]; } enum TransferFunctionType { @@ -95,7 +96,10 @@ message TransferFunction { message ConditionalPay { // pay_timestamp is set by payment source, to ensure no same condpay between src-dst // global unique pay id used on-chain is computed as hash(hash(cond_pay), pay_resolver_address) - uint64 pay_timestamp = 1 [(soltype) = "uint", jstype = JS_STRING]; + uint64 pay_timestamp = 1 [ + (soltype) = "uint", + jstype = JS_STRING + ]; // src and dest are public keys of payment sender and receiver used to vouch the payment result. // For simplicity, current off-chain backend implementation requires these two fields to be the // sender and receiver account addresses. With better off-chain communication protocols in the @@ -109,7 +113,7 @@ message ConditionalPay { // transfer_func.max_transfer.receiver.account is not needed for unicast payment TransferFunction transfer_func = 5; // resolve_deadline is the deadline for a cond_pay to be resolved on chain in the - // pay resgistry by either condition or vouched results, and the payment result + // pay registry by either condition or vouched results, and the payment result // is finalized after resolve_deadline. // Payment channel peers should apply a safe_margin for off-chain processing, // i.e., should take dispute action before [resolve_deadline - safe_margin] diff --git a/proto/message.proto b/proto/message.proto index e64ffda..5f39cb7 100644 --- a/proto/message.proto +++ b/proto/message.proto @@ -1,13 +1,14 @@ // Copyright 2018-2025 Celer Network syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/rpc"; package rpc; // For Proto V2 import "entity.proto"; import "google/protobuf/any.proto"; +option go_package = "github.com/celer-network/agent-pay/rpc"; + // MID is the message identifier, used as map key for unary over stream // NOTE: all field types must be golang comparable so map[MID] can work // Auth requester should set its mid to start_mid in AuthAck @@ -393,7 +394,7 @@ message ChannelInAuth { message PayInAuthAck { bytes pay = 1; // pay bytes - google.protobuf.Any note = 2; // pay note + google.protobuf.Any note = 2; // pay note // pay state, from instate or outstate depending on which simplex int64 state = 3; } @@ -404,6 +405,7 @@ message DelegationDescription { bytes delegator = 1; // address of delegatee bytes delegatee = 2; + // Off-chain delegation expiry. Unix timestamp (seconds). Field name kept for wire-format back-compat. int64 expires_after_block = 3; // token addresses to be delegated repeated bytes token_to_delegate = 4; @@ -529,4 +531,4 @@ message RoutingRequest { repeated SignedRoutingUpdate updates = 1; // OSP that sent (propagated) this information. string sender = 2; -} \ No newline at end of file +} diff --git a/proto/multiserver.proto b/proto/multiserver.proto index 8c2a95a..76a5fc1 100644 --- a/proto/multiserver.proto +++ b/proto/multiserver.proto @@ -4,12 +4,12 @@ syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/rpc"; - package rpc; import "message.proto"; +option go_package = "github.com/celer-network/agent-pay/rpc"; + // Interface exported by the server on an internal port (inter-server). service MultiServer { rpc FwdMsg(FwdReq) returns (FwdReply) {} @@ -31,8 +31,7 @@ message FwdReply { } // Next tag: 1 -message PingReq { -} +message PingReq {} // Next tag: 2 message PingReply { @@ -58,5 +57,4 @@ message BcastRoutingRequest { } // Next tag: 1 -message BcastRoutingReply { -} +message BcastRoutingReply {} diff --git a/proto/osp_admin.proto b/proto/osp_admin.proto index 99db3e4..8437a8c 100644 --- a/proto/osp_admin.proto +++ b/proto/osp_admin.proto @@ -2,14 +2,15 @@ syntax = "proto3"; package rpc; -option go_package = "github.com/celer-network/agent-pay/rpc"; +import "entity.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; import "google/protobuf/empty.proto"; -import "entity.proto"; import "message.proto"; +option go_package = "github.com/celer-network/agent-pay/rpc"; + // Next Tag: 3 message RegisterStreamRequest { string peer_rpc_address = 1; diff --git a/proto/osp_report.proto b/proto/osp_report.proto index 782be5a..88b09c3 100644 --- a/proto/osp_report.proto +++ b/proto/osp_report.proto @@ -1,57 +1,58 @@ // Copyright 2018-2025 Celer Network syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/route/ospreport"; package ospreport; +option go_package = "github.com/celer-network/agent-pay/route/ospreport"; + // OSP voluntarily periodically send OspReport to the Celer Explorer server message OspReport { - // serialized OspInfo - bytes osp_info = 1; - // signature of osp_info, signed by OSP eth address - bytes sig = 2; + // serialized OspInfo + bytes osp_info = 1; + // signature of osp_info, signed by OSP eth address + bytes sig = 2; } message OspInfo { - // OSP eth address - string eth_addr = 1; - // UTC unix timestamp in second - uint64 timestamp = 2; - // server public rpc host:port - string rpc_host = 3; - repeated PeerBalances osp_peers = 4; - // number of payments processed - int64 payments = 5; - // accept anyone to connect - bool open_accept = 6; - // standard open channel configuration - repeated StdOpenChanConfig std_openchan_configs = 7; - AdminInfo admin_info = 8; + // OSP eth address + string eth_addr = 1; + // UTC unix timestamp in second + uint64 timestamp = 2; + // server public rpc host:port + string rpc_host = 3; + repeated PeerBalances osp_peers = 4; + // number of payments processed + int64 payments = 5; + // accept anyone to connect + bool open_accept = 6; + // standard open channel configuration + repeated StdOpenChanConfig std_openchan_configs = 7; + AdminInfo admin_info = 8; } message PeerBalances { - string peer = 1; - repeated ChannelBalance balances = 2; + string peer = 1; + repeated ChannelBalance balances = 2; } message ChannelBalance { - string cid = 1; - string token_addr = 2; - string self_balance = 3; - string peer_balance = 4; + string cid = 1; + string token_addr = 2; + string self_balance = 3; + string peer_balance = 4; } // standard open channel config message StdOpenChanConfig { - string token_addr = 1; - string min_deposit = 2; - string max_deposit = 3; + string token_addr = 1; + string min_deposit = 2; + string max_deposit = 3; } message AdminInfo { - string name = 1; - string email = 2; - string organization = 3; - string address = 4; - string website = 5; + string name = 1; + string email = 2; + string organization = 3; + string address = 4; + string website = 5; } diff --git a/proto/rpc.proto b/proto/rpc.proto index 1cc1b7f..0819783 100644 --- a/proto/rpc.proto +++ b/proto/rpc.proto @@ -1,11 +1,12 @@ // Copyright 2018-2025 Celer Network syntax = "proto3"; -option go_package = "github.com/celer-network/agent-pay/rpc"; package rpc; import "message.proto"; +option go_package = "github.com/celer-network/agent-pay/rpc"; + // Interface exported by the server. service Rpc { rpc GetPayHistory(GetPayHistoryRequest) returns (GetPayHistoryResponse) {} diff --git a/route/controller.go b/route/controller.go index f19b283..6a93e70 100644 --- a/route/controller.go +++ b/route/controller.go @@ -57,13 +57,18 @@ const ( const ( // A router OSP checks the router registry at startup and then every checkRegistryInterval to see - // whether its registry time is more than refreshIntervalBlock before or not, and refresh itself - // onchain if so. It also scans the local rtBuilder.getAllOsps() for every checkRegistryInterval - // (first scan time is startupTime + checkRegistryInterval), and removes expired OSPs if they - // have not been refreshed for expireTimeoutBlock. - checkRegistryInterval = 6 * time.Hour // time interval to check for self-refresh and OSP timeouts - refreshIntervalBlock = uint64(36000) // block interval for OSP to refresh registry - expireTimeoutBlock = uint64(50000) // remove OSP as router if not refreshed within timeout blocks + // whether its registry time is older than refreshIntervalSec, and refreshes itself onchain if so. + // It also scans the local rtBuilder.getAllOsps() each interval (first scan at + // startupTime + checkRegistryInterval) and removes routers whose stored timestamp is older than + // expireTimeoutSec. The contract stores `block.timestamp` (unix seconds) per router, so these + // thresholds are likewise in seconds. + checkRegistryInterval = 6 * time.Hour // time interval to check for self-refresh and OSP timeouts + refreshIntervalSec = uint64(432000) // 5 days, seconds — refresh self if stored ts is older + expireTimeoutSec = uint64(604800) // 7 days, seconds — drop a router whose stored ts is older + // eventBacktrackBlocks is how far back the on-chain event monitor scans on startup so it + // won't miss a still-relevant RouterUpdated event. This stays a block count because the + // event monitor's StartBlock is a block height, independent of contract deadline semantics. + eventBacktrackBlocks = uint64(50000) routeTTL = 15 ) @@ -103,17 +108,18 @@ func NewController( // Start starts router process to instantiate OSP as a router. func (c *Controller) Start() { - // check if OSP is registered on-chain as a router - blknum, err := c.queryRouterRegistry() + // check if OSP is registered on-chain as a router. Stored value is the unix + // timestamp (seconds) of the most recent register/refresh — see RouterRegistry.sol. + registeredAt, err := c.queryRouterRegistry() if err != nil { log.Errorf("query router registry failed: %s", err) return } - if blknum != 0 { - log.Infoln("router registered / refreshed at block", blknum) + if registeredAt != 0 { + log.Infoln("router registered / refreshed at unix ts", registeredAt) // check if OSP needs to send refresh transaction - currentBlk := c.monitorService.GetCurrentBlockNumber().Uint64() - if currentBlk-blknum > refreshIntervalBlock { + nowTs := uint64(time.Now().Unix()) + if nowTs-registeredAt > refreshIntervalSec { c.refreshRouterRegistry() } // start onchain events monitor @@ -149,7 +155,11 @@ func (c *Controller) monitorRouterUpdatedEvent() { txHash := fmt.Sprintf("%x", eLog.TxHash) log.Infoln("Seeing RouterUpdated event, router addr:", routerAddr, "tx hash:", txHash, "callback id:", id, "blkNum:", eLog.BlockNumber) - c.processRouterUpdatedEvent(e, eLog.BlockNumber) + // The contract stores `block.timestamp` (unix seconds) per router; since the event + // fired in approximately the current block, time.Now() is within a few seconds of + // the canonical contract value. The off-chain comparisons use multi-day windows, so + // this approximation is operationally lossless. + c.processRouterUpdatedEvent(e, uint64(time.Now().Unix())) return false }, ) @@ -160,22 +170,22 @@ func (c *Controller) monitorRouterUpdatedEvent() { } // processes the RouterUpdated event according to various router opeartion -func (c *Controller) processRouterUpdatedEvent(e *rt.RouterRegistryRouterUpdated, blkNum uint64) { +func (c *Controller) processRouterUpdatedEvent(e *rt.RouterRegistryRouterUpdated, registeredAt uint64) { switch e.Op { case routerAdded: - c.addRouter(e.RouterAddress, blkNum) + c.addRouter(e.RouterAddress, registeredAt) case routerRemoved: c.removeRouter(e.RouterAddress) case routerRefreshed: - c.refreshRouter(e.RouterAddress, blkNum) + c.refreshRouter(e.RouterAddress, registeredAt) default: log.Warnf("Unknown router operation from router registry contract: %v", e.Op) } } -// adds router node and record the block number -func (c *Controller) addRouter(routerAddr ctype.Addr, blkNum uint64) { - c.rtBuilder.markOsp(routerAddr, blkNum) +// adds router node and record the unix timestamp of register/refresh +func (c *Controller) addRouter(routerAddr ctype.Addr, registeredAt uint64) { + c.rtBuilder.markOsp(routerAddr, registeredAt) } // removes router node and delete it from the map @@ -186,52 +196,54 @@ func (c *Controller) removeRouter(routerAddr ctype.Addr) { c.rtBuilder.unmarkOsp(routerAddr) } -// refreshes a router node and update block number in the map -func (c *Controller) refreshRouter(routerAddr ctype.Addr, blkNum uint64) { - c.rtBuilder.markOsp(routerAddr, blkNum) +// refreshes a router node and update its stored register/refresh unix timestamp. +func (c *Controller) refreshRouter(routerAddr ctype.Addr, registeredAt uint64) { + c.rtBuilder.markOsp(routerAddr, registeredAt) } // calculates the start block number for event monitor service. // No matter whether Osp starts from scratch or starts from existing database, -// Osp only backtracks one interval back from the current block number. -// Interval is the same as the expire interval in rtconfig +// Osp backtracks eventBacktrackBlocks from the current block so it won't miss +// a still-relevant RouterUpdated event. func (c *Controller) calculateStartBlockNumber() *big.Int { currentBlk := c.monitorService.GetCurrentBlockNumber() - timeout := big.NewInt(0).SetUint64(expireTimeoutBlock) - if timeout.Cmp(currentBlk) == 1 { + backtrack := big.NewInt(0).SetUint64(eventBacktrackBlocks) + if backtrack.Cmp(currentBlk) == 1 { return big.NewInt(0) } - return currentBlk.Sub(currentBlk, timeout) // start block number for onchain monitor service + return currentBlk.Sub(currentBlk, backtrack) // start block number for onchain monitor service } // call routerInfo in router registry contract to check if Osp has been registered. -// Return value is the block number corresponding to Osp address +// Return value is the unix timestamp (seconds) of the most recent register/refresh +// for this Osp address — the contract stores `block.timestamp`, see RouterRegistry.sol. func (c *Controller) queryRouterRegistry() (uint64, error) { routerRegistryAddr := c.nodeConfig.GetRouterRegistryContract().GetAddr() caller, err := rt.NewRouterRegistryCaller(routerRegistryAddr, c.transactor.ContractCaller()) if err != nil { return 0, err } - blknum, err := caller.RouterInfo(&bind.CallOpts{}, c.transactor.Address()) + registeredAt, err := caller.RouterInfo(&bind.CallOpts{}, c.transactor.Address()) if err != nil { return 0, err } - return blknum.Uint64(), nil + return registeredAt.Uint64(), nil } func (c *Controller) checkAndRefreshIfNeeded() { - blknum, err := c.queryRouterRegistry() + registeredAt, err := c.queryRouterRegistry() if err != nil { log.Errorf("query router registry failed: %s", err) return } - currentBlk := c.monitorService.GetCurrentBlockNumber().Uint64() - if currentBlk-blknum > refreshIntervalBlock { + nowTs := uint64(time.Now().Unix()) + if nowTs-registeredAt > refreshIntervalSec { c.refreshRouterRegistry() } } -// send on-chain transaction to refresh the block number of Osp address. +// send on-chain transaction to refresh the OSP address's last-seen unix +// timestamp in the RouterRegistry. // CAUTION: need to pay attention if it fails to refresh func (c *Controller) refreshRouterRegistry() { log.Infoln("sending RefreshRouter tx") @@ -291,19 +303,19 @@ func (c *Controller) runRoutersRoutineJob() { // Traverses the map and remove the expired routers. func (c *Controller) removeExpiredRouters() { - currentBlk := c.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) ospInfo := c.rtBuilder.getAllOsps() for addr := range ospInfo { - blk := ospInfo[addr].RegistryBlock + registeredAt := ospInfo[addr].RegistryTime - if isRouterExpired(blk, currentBlk) { + if isRouterExpired(registeredAt, nowTs) { c.rtBuilder.unmarkOsp(addr) } } } -func isRouterExpired(routerBlk, currentBlk uint64) bool { - return routerBlk+expireTimeoutBlock < currentBlk +func isRouterExpired(registeredAt, nowTs uint64) bool { + return registeredAt+expireTimeoutSec < nowTs } // Get my dynamic routing information and broadcast it to peer OSPs. @@ -342,10 +354,10 @@ func (c *Controller) bcastRouterInfo() { func (c *Controller) gatherChannelInfo() []*rpc.ChannelRoutingInfo { var channels []*rpc.ChannelRoutingInfo - blkNum := c.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) for _, neighbor := range c.rtBuilder.getAliveNeighbors() { for _, cid := range neighbor.TokenCids { - bal, err := ledgerview.GetBalance(c.dal, cid, c.nodeConfig.GetOnChainAddr(), blkNum) + bal, err := ledgerview.GetBalance(c.dal, cid, c.nodeConfig.GetOnChainAddr(), nowTs) if err != nil { log.Error(err) continue @@ -489,13 +501,13 @@ func (c *Controller) reportOspInfoToExplorer() { } // set osp peers c.explorerReport.OspPeers = nil - blkNum := c.monitorService.GetCurrentBlockNumber().Uint64() + nowTs := uint64(time.Now().Unix()) for addr, neighbor := range c.rtBuilder.getAliveNeighbors() { peerBalances := &ospreport.PeerBalances{ Peer: addr.Hex(), // format required by explorer } for tk, cid := range neighbor.TokenCids { - bal, err := ledgerview.GetBalance(c.dal, cid, c.nodeConfig.GetOnChainAddr(), blkNum) + bal, err := ledgerview.GetBalance(c.dal, cid, c.nodeConfig.GetOnChainAddr(), nowTs) if err != nil { log.Error(err) continue diff --git a/route/routerregistry/routerregistry.go b/route/routerregistry/routerregistry.go index 4f419a4..bbc4151 100644 --- a/route/routerregistry/routerregistry.go +++ b/route/routerregistry/routerregistry.go @@ -32,7 +32,7 @@ var ( // RouterRegistryMetaData contains all meta data concerning the RouterRegistry contract. var RouterRegistryMetaData = &bind.MetaData{ ABI: "[{\"type\":\"function\",\"name\":\"deregisterRouter\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"refreshRouter\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerRouter\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"routerInfo\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"event\",\"name\":\"RouterUpdated\",\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\",\"indexed\":true,\"internalType\":\"enumIRouterRegistry.RouterOperation\"},{\"name\":\"routerAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false}]", - Bin: "0x6080604052348015600e575f5ffd5b506102818061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c806324f277d21461004e5780632ff0282b146100585780637880945614610060578063d1cf70d114610091575b5f5ffd5b610056610099565b005b610056610136565b61007f61006e36600461021e565b5f6020819052908152604090205481565b60405190815260200160405180910390f35b6100566101ab565b335f90815260208190526040902054156100fa5760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320616c72656164792065786973747300000060448201526064015b60405180910390fd5b335f8181526020819052604081204390555b6040517fed739f5df64012854c2039ba144af8e3af26211fc7f10a959c6a592ae58c4491905f90a3565b335f9081526020819052604081205490036101935760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f818152602081905260409020439055600261010c565b335f9081526020819052604081205490036102085760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f81815260208190526040812055600161010c565b5f6020828403121561022e575f5ffd5b81356001600160a01b0381168114610244575f5ffd5b939250505056fea26469706673582212204a9798eb9c34c961b1979f06aa33fe45efd06fcbefd386adb4ffc2a6910bb30d64736f6c634300081d0033", + Bin: "0x6080604052348015600e575f5ffd5b506102818061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c806324f277d21461004e5780632ff0282b146100585780637880945614610060578063d1cf70d114610091575b5f5ffd5b610056610099565b005b610056610136565b61007f61006e36600461021e565b5f6020819052908152604090205481565b60405190815260200160405180910390f35b6100566101ab565b335f90815260208190526040902054156100fa5760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320616c72656164792065786973747300000060448201526064015b60405180910390fd5b335f8181526020819052604081204290555b6040517fed739f5df64012854c2039ba144af8e3af26211fc7f10a959c6a592ae58c4491905f90a3565b335f9081526020819052604081205490036101935760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f818152602081905260409020429055600261010c565b335f9081526020819052604081205490036102085760405162461bcd60e51b815260206004820152601d60248201527f526f75746572206164647265737320646f6573206e6f7420657869737400000060448201526064016100f1565b335f81815260208190526040812055600161010c565b5f6020828403121561022e575f5ffd5b81356001600160a01b0381168114610244575f5ffd5b939250505056fea264697066735822122022d5647e3ba34f507ce9aa3328e73a0e10522cc666f87eb783f4629fb6e1fbdc64736f6c634300081e0033", } // RouterRegistryABI is the input ABI used to generate the binding from. diff --git a/route/rt_builder.go b/route/rt_builder.go index 4d530e9..121ac7c 100644 --- a/route/rt_builder.go +++ b/route/rt_builder.go @@ -20,8 +20,9 @@ import ( type Edge = structs.Edge type OspInfo struct { - // block number of last onchain routerRegistry update - RegistryBlock uint64 + // Unix timestamp (seconds) of the most recent on-chain RouterRegistry register/refresh. + // Field name reflects the contract's `block.timestamp`-based storage. + RegistryTime uint64 // time of last route message update UpdateTime time.Time } @@ -220,18 +221,19 @@ func (b *routingTableBuilder) updateOspEdge( } } -// markOsp marks an Osp as a router and records its block number -func (b *routingTableBuilder) markOsp(ospAddr ctype.Addr, blknum uint64) { +// markOsp marks an Osp as a router and records the unix timestamp (seconds) +// of its most recent on-chain register/refresh. +func (b *routingTableBuilder) markOsp(ospAddr ctype.Addr, registeredAt uint64) { b.graphLock.Lock() defer b.graphLock.Unlock() log.Infof("markOsp: %x", ospAddr) if _, ok := b.osps[ospAddr]; ok { - b.osps[ospAddr].RegistryBlock = blknum + b.osps[ospAddr].RegistryTime = registeredAt } else { now := now() b.osps[ospAddr] = &OspInfo{ - RegistryBlock: blknum, - UpdateTime: now, + RegistryTime: registeredAt, + UpdateTime: now, } log.Debugf("add osp %x to neighbor map", ospAddr) cids, tokens, err := b.dal.GetCidTokensByPeer(ospAddr) diff --git a/rpc/message.pb.go b/rpc/message.pb.go index e63bdbc..3a7d077 100644 --- a/rpc/message.pb.go +++ b/rpc/message.pb.go @@ -2575,8 +2575,9 @@ type DelegationDescription struct { // address of delegator Delegator []byte `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"` // address of delegatee - Delegatee []byte `protobuf:"bytes,2,opt,name=delegatee,proto3" json:"delegatee,omitempty"` - ExpiresAfterBlock int64 `protobuf:"varint,3,opt,name=expires_after_block,json=expiresAfterBlock,proto3" json:"expires_after_block,omitempty"` + Delegatee []byte `protobuf:"bytes,2,opt,name=delegatee,proto3" json:"delegatee,omitempty"` + // Off-chain delegation expiry. Unix timestamp (seconds). Field name kept for wire-format back-compat. + ExpiresAfterBlock int64 `protobuf:"varint,3,opt,name=expires_after_block,json=expiresAfterBlock,proto3" json:"expires_after_block,omitempty"` // token addresses to be delegated TokenToDelegate [][]byte `protobuf:"bytes,4,rep,name=token_to_delegate,json=tokenToDelegate,proto3" json:"token_to_delegate,omitempty"` unknownFields protoimpl.UnknownFields diff --git a/rpc/multiserver_grpc.pb.go b/rpc/multiserver_grpc.pb.go index da38c19..0383313 100644 --- a/rpc/multiserver_grpc.pb.go +++ b/rpc/multiserver_grpc.pb.go @@ -68,16 +68,17 @@ func (c *multiServerClient) BcastRoutingInfo(ctx context.Context, in *BcastRouti } // MultiServerServer is the server API for MultiServer service. -// All implementations should embed UnimplementedMultiServerServer +// All implementations must embed UnimplementedMultiServerServer // for forward compatibility type MultiServerServer interface { FwdMsg(context.Context, *FwdReq) (*FwdReply, error) Ping(context.Context, *PingReq) (*PingReply, error) PickServer(context.Context, *PickReq) (*PickReply, error) BcastRoutingInfo(context.Context, *BcastRoutingRequest) (*BcastRoutingReply, error) + mustEmbedUnimplementedMultiServerServer() } -// UnimplementedMultiServerServer should be embedded to have forward compatible implementations. +// UnimplementedMultiServerServer must be embedded to have forward compatible implementations. type UnimplementedMultiServerServer struct { } @@ -93,6 +94,7 @@ func (UnimplementedMultiServerServer) PickServer(context.Context, *PickReq) (*Pi func (UnimplementedMultiServerServer) BcastRoutingInfo(context.Context, *BcastRoutingRequest) (*BcastRoutingReply, error) { return nil, status.Errorf(codes.Unimplemented, "method BcastRoutingInfo not implemented") } +func (UnimplementedMultiServerServer) mustEmbedUnimplementedMultiServerServer() {} // UnsafeMultiServerServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to MultiServerServer will diff --git a/rpc/osp_admin.pb.go b/rpc/osp_admin.pb.go index 3f85f89..5d66d9c 100644 --- a/rpc/osp_admin.pb.go +++ b/rpc/osp_admin.pb.go @@ -1006,7 +1006,7 @@ var File_osp_admin_proto protoreflect.FileDescriptor const file_osp_admin_proto_rawDesc = "" + "\n" + - "\x0fosp_admin.proto\x12\x03rpc\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/protobuf/any.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\fentity.proto\x1a\rmessage.proto\"k\n" + + "\x0fosp_admin.proto\x12\x03rpc\x1a\fentity.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/protobuf/any.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\rmessage.proto\"k\n" + "\x15RegisterStreamRequest\x12(\n" + "\x10peer_rpc_address\x18\x01 \x01(\tR\x0epeerRpcAddress\x12(\n" + "\x10peer_eth_address\x18\x02 \x01(\fR\x0epeerEthAddress\"\xad\x01\n" + diff --git a/rpc/osp_admin_grpc.pb.go b/rpc/osp_admin_grpc.pb.go index 58f6c96..db7382a 100644 --- a/rpc/osp_admin_grpc.pb.go +++ b/rpc/osp_admin_grpc.pb.go @@ -160,7 +160,7 @@ func (c *adminClient) CooperativeSettle(ctx context.Context, in *ChannelOpReques } // AdminServer is the server API for Admin service. -// All implementations should embed UnimplementedAdminServer +// All implementations must embed UnimplementedAdminServer // for forward compatibility type AdminServer interface { // ConfirmOnChainResolvedPaysWithPeerOsps instructs Osp to confirm on-chain resolved pays between itself and connected osps. @@ -186,9 +186,10 @@ type AdminServer interface { RegisterStream(context.Context, *RegisterStreamRequest) (*emptypb.Empty, error) CooperativeWithdraw(context.Context, *ChannelOpRequest) (*ChannelOpResponse, error) CooperativeSettle(context.Context, *ChannelOpRequest) (*ChannelOpResponse, error) + mustEmbedUnimplementedAdminServer() } -// UnimplementedAdminServer should be embedded to have forward compatible implementations. +// UnimplementedAdminServer must be embedded to have forward compatible implementations. type UnimplementedAdminServer struct { } @@ -228,6 +229,7 @@ func (UnimplementedAdminServer) CooperativeWithdraw(context.Context, *ChannelOpR func (UnimplementedAdminServer) CooperativeSettle(context.Context, *ChannelOpRequest) (*ChannelOpResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CooperativeSettle not implemented") } +func (UnimplementedAdminServer) mustEmbedUnimplementedAdminServer() {} // UnsafeAdminServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AdminServer will diff --git a/rpc/rpc_grpc.pb.go b/rpc/rpc_grpc.pb.go index ee5464e..cf1032f 100644 --- a/rpc/rpc_grpc.pb.go +++ b/rpc/rpc_grpc.pb.go @@ -131,7 +131,7 @@ func (c *rpcClient) CelerMigrateChannel(ctx context.Context, in *MigrateChannelR } // RpcServer is the server API for Rpc service. -// All implementations should embed UnimplementedRpcServer +// All implementations must embed UnimplementedRpcServer // for forward compatibility type RpcServer interface { GetPayHistory(context.Context, *GetPayHistoryRequest) (*GetPayHistoryResponse, error) @@ -143,9 +143,10 @@ type RpcServer interface { // unified offchain bidi streaming rpc and msg definition CelerStream(Rpc_CelerStreamServer) error CelerMigrateChannel(context.Context, *MigrateChannelRequest) (*MigrateChannelResponse, error) + mustEmbedUnimplementedRpcServer() } -// UnimplementedRpcServer should be embedded to have forward compatible implementations. +// UnimplementedRpcServer must be embedded to have forward compatible implementations. type UnimplementedRpcServer struct { } @@ -173,6 +174,7 @@ func (UnimplementedRpcServer) CelerStream(Rpc_CelerStreamServer) error { func (UnimplementedRpcServer) CelerMigrateChannel(context.Context, *MigrateChannelRequest) (*MigrateChannelResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CelerMigrateChannel not implemented") } +func (UnimplementedRpcServer) mustEmbedUnimplementedRpcServer() {} // UnsafeRpcServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RpcServer will diff --git a/rtconfig/config.pb.go b/rtconfig/config.pb.go index 667a11e..dc9c96d 100644 --- a/rtconfig/config.pb.go +++ b/rtconfig/config.pb.go @@ -60,7 +60,7 @@ type RuntimeConfig struct { StandardConfigs *StandardConfigs `protobuf:"bytes,13,opt,name=standard_configs,json=standardConfigs,proto3" json:"standard_configs,omitempty"` // OspToOsp config is keyed by pair (peerOspAddr, tokenAddr) OspToOspOpenConfigs *OspToOspOpenConfigs `protobuf:"bytes,17,opt,name=osp_to_osp_open_configs,json=ospToOspOpenConfigs,proto3" json:"osp_to_osp_open_configs,omitempty"` - // max payment timeout (in block number) OSP accepts + // max payment timeout (in seconds) the OSP accepts MaxPaymentTimeout uint64 `protobuf:"varint,14,opt,name=max_payment_timeout,json=maxPaymentTimeout,proto3" json:"max_payment_timeout,omitempty"` // max number of pending pay IDs in the simplex state MaxNumPendingPays uint64 `protobuf:"varint,15,opt,name=max_num_pending_pays,json=maxNumPendingPays,proto3" json:"max_num_pending_pays,omitempty"` diff --git a/rtconfig/config.proto b/rtconfig/config.proto index 6c5443a..41a2ac1 100644 --- a/rtconfig/config.proto +++ b/rtconfig/config.proto @@ -39,7 +39,7 @@ message RuntimeConfig { StandardConfigs standard_configs = 13; // OspToOsp config is keyed by pair (peerOspAddr, tokenAddr) OspToOspOpenConfigs osp_to_osp_open_configs = 17; - // max payment timeout (in block number) OSP accepts + // max payment timeout (in seconds) the OSP accepts uint64 max_payment_timeout = 14; // max number of pending pay IDs in the simplex state uint64 max_num_pending_pays = 15; diff --git a/rtconfig/rtconfig.go b/rtconfig/rtconfig.go index 880141a..9048355 100644 --- a/rtconfig/rtconfig.go +++ b/rtconfig/rtconfig.go @@ -26,12 +26,14 @@ var ( ) const ( - defaultStreamSendTimeoutS = uint64(1) - defaultOspDepositMultiplier = int64(10) - defaultMaxDisputeTimeout = uint64(20000) - defaultMinDisputeTimeout = uint64(8000) + defaultStreamSendTimeoutS = uint64(1) + defaultOspDepositMultiplier = int64(10) + // Dispute / payment timeouts are seconds — the contracts now compare against + // `block.timestamp`, so the off-chain bounds use the same unit. + defaultMaxDisputeTimeout = uint64(259200) // 3 days, seconds + defaultMinDisputeTimeout = uint64(43200) // 12 hours, seconds defaultColdBootstrapDeposit = uint64(1e18) - defaultMaxPaymentTimeout = uint64(10000) + defaultMaxPaymentTimeout = uint64(86400) // 1 day, seconds defaultMaxNumPendingPays = uint64(200) defaultRefillMaxWait = uint64(180) defaultRefillPoolLowRatio = float64(0.2) diff --git a/server/osp_webapi_backend.go b/server/osp_webapi_backend.go index 94504fd..5719e2e 100644 --- a/server/osp_webapi_backend.go +++ b/server/osp_webapi_backend.go @@ -67,8 +67,6 @@ func (b *ospWebapiBackend) CreateAppSessionOnVirtualContract(request *webrpc.Cre ctype.Hex2Bytes(request.GetContractBin()), ctype.Hex2Bytes(request.GetContractConstructor()), request.GetNonce(), - request.GetOnChainTimeout(), - nil, ) } @@ -77,10 +75,6 @@ func (b *ospWebapiBackend) DeleteAppSession(sessionID string) error { return nil } -func (b *ospWebapiBackend) GetStatusForAppSession(sessionID string) (uint8, error) { - return b.cNode.AppClient.GetAppChannelStatus(sessionID) -} - func (b *ospWebapiBackend) GetIncomingPaymentState(payID ctype.PayIDType) (int, error) { inState, _, _, err := b.cNode.GetDAL().GetPayStates(payID) return inState, err @@ -122,9 +116,9 @@ func (b *ospWebapiBackend) sendBooleanPayment( return ctype.ZeroPayID, err } - currentBlock := b.cNode.GetCurrentBlockNumber().Uint64() - resolveDeadline := currentBlock + timeout - if resolveDeadline <= currentBlock { + nowTs := uint64(time.Now().Unix()) + resolveDeadline := nowTs + timeout + if resolveDeadline <= nowTs { return ctype.ZeroPayID, common.ErrDeadlinePassed } diff --git a/server/server.go b/server/server.go index 02c5d8d..48bc835 100644 --- a/server/server.go +++ b/server/server.go @@ -735,7 +735,7 @@ func (s *adminService) SendToken(ctx context.Context, in *rpc.SendTokenRequest) LogicType: entity.TransferFunctionType_BOOLEAN_AND, MaxTransfer: tokenTransfer, }, - ResolveDeadline: s.cNode.GetCurrentBlockNumber().Uint64() + config.AdminSendTokenTimeout, + ResolveDeadline: uint64(time.Now().Unix()) + config.AdminSendTokenTimeout, ResolveTimeout: config.PayResolveTimeout, } diff --git a/storage/dal.go b/storage/dal.go index ab29982..7f7d45f 100644 --- a/storage/dal.go +++ b/storage/dal.go @@ -28,7 +28,7 @@ const ( // OSP only, track path of failed payments payPathTable = "ppt" // payID -> rpc.PayPath // client only - queryTimeTable = "qtt" // query -> last time (unit defined by query, either unix sec or block number) + queryTimeTable = "qtt" // query -> unix-second timestamp of last successful run // single-entry self netid table netIdTable = "netid" @@ -861,16 +861,16 @@ func (dtx *DALTx) GetPeerCids(peer ctype.Addr) ([]ctype.CidType, bool, error) { } // The "desttokens" table. -func (d *DAL) InsertDestToken(dest ctype.Addr, token *entity.TokenInfo, osps []ctype.Addr, chanBlockNum uint64) error { - return insertDestToken(d.st, dest, token, osps, chanBlockNum) +func (d *DAL) InsertDestToken(dest ctype.Addr, token *entity.TokenInfo, osps []ctype.Addr, openTs uint64) error { + return insertDestToken(d.st, dest, token, osps, openTs) } -func (d *DAL) GetDestTokenOpenChanBlkNum(dest ctype.Addr, token *entity.TokenInfo) (uint64, bool, error) { - return getDestTokenOpenChanBlkNum(d.st, dest, token) +func (d *DAL) GetDestTokenOpenTs(dest ctype.Addr, token *entity.TokenInfo) (uint64, bool, error) { + return getDestTokenOpenTs(d.st, dest, token) } -func (d *DAL) UpsertDestTokenOpenChanBlkNum(dest ctype.Addr, token *entity.TokenInfo, chanBlockNum uint64) error { - return upsertDestTokenOpenChanBlkNum(d.st, dest, token, chanBlockNum) +func (d *DAL) UpsertDestTokenOpenTs(dest ctype.Addr, token *entity.TokenInfo, openTs uint64) error { + return upsertDestTokenOpenTs(d.st, dest, token, openTs) } func (d *DAL) UpdateDestTokenOsps(dest ctype.Addr, token *entity.TokenInfo, osps []ctype.Addr) error { diff --git a/storage/dal_sql.go b/storage/dal_sql.go index d8d11ed..b2b5af9 100644 --- a/storage/dal_sql.go +++ b/storage/dal_sql.go @@ -2153,42 +2153,42 @@ func insertDestToken( dest ctype.Addr, token *entity.TokenInfo, osps []ctype.Addr, - chanBlockNum uint64) error { + openTs uint64) error { s := make([]string, 0, len(osps)) for _, o := range osps { s = append(s, ctype.Addr2Hex(o)) } - q := `INSERT INTO desttokens (dest, token, osps, openchanblknum) + q := `INSERT INTO desttokens (dest, token, osps, openchants) VALUES ($1, $2, $3, $4)` res, err := st.Exec(q, ctype.Addr2Hex(dest), utils.GetTokenAddrStr(token), - strings.Join(s, listSep), chanBlockNum) + strings.Join(s, listSep), openTs) return chkExec(res, err, 1, "insertDestToken") } -func getDestTokenOpenChanBlkNum( +func getDestTokenOpenTs( st SqlStorage, dest ctype.Addr, token *entity.TokenInfo) (uint64, bool, error) { - var blkNum uint64 - q := `SELECT openchanblknum FROM desttokens WHERE dest = $1 AND token = $2` + var openTs uint64 + q := `SELECT openchants FROM desttokens WHERE dest = $1 AND token = $2` err := st.QueryRow(q, ctype.Addr2Hex(dest), - utils.GetTokenAddrStr(token)).Scan(&blkNum) + utils.GetTokenAddrStr(token)).Scan(&openTs) found, err := chkQueryRow(err) - return blkNum, found, err + return openTs, found, err } -func upsertDestTokenOpenChanBlkNum( +func upsertDestTokenOpenTs( st SqlStorage, dest ctype.Addr, token *entity.TokenInfo, - chanBlockNum uint64) error { - q := `INSERT INTO desttokens (dest, token, osps, openchanblknum) + openTs uint64) error { + q := `INSERT INTO desttokens (dest, token, osps, openchants) VALUES ($1, $2, $3, $4) ON CONFLICT (dest, token) - DO UPDATE SET openchanblknum = excluded.openchanblknum` + DO UPDATE SET openchants = excluded.openchants` res, err := st.Exec(q, ctype.Addr2Hex(dest), - utils.GetTokenAddrStr(token), "", chanBlockNum) - return chkExec(res, err, 1, "upsertDestTokenOpenChanBlkNum") + utils.GetTokenAddrStr(token), "", openTs) + return chkExec(res, err, 1, "upsertDestTokenOpenTs") } func updateDestTokenOsps( diff --git a/storage/schema.sql b/storage/schema.sql index b6e50e4..8f7d247 100644 --- a/storage/schema.sql +++ b/storage/schema.sql @@ -157,7 +157,7 @@ CREATE TABLE IF NOT EXISTS desttokens ( dest TEXT NOT NULL, token TEXT NOT NULL, osps TEXT NOT NULL, -- comma-separated list of access OSPs - openchanblknum INT NOT NULL, + openchants INT NOT NULL, -- unix-second timestamp of the channel-open UNIQUE (dest, token) ); diff --git a/storage/schema.sql.go b/storage/schema.sql.go index c6145cf..9b14841 100644 --- a/storage/schema.sql.go +++ b/storage/schema.sql.go @@ -30,7 +30,7 @@ var sqlSchemaCmds = [...]string{ "CREATE TABLE IF NOT EXISTS nettokens ( netid INT NOT NULL, nettoken TEXT NOT NULL, localtoken TEXT NOT NULL, rate FLOAT NOT NULL, UNIQUE (netid, nettoken), UNIQUE (netid, localtoken) );", "CREATE TABLE IF NOT EXISTS peers ( peer TEXT PRIMARY KEY NOT NULL, server TEXT NOT NULL, activecids TEXT NOT NULL, delegateproof BYTEA );", "CREATE INDEX IF NOT EXISTS peers_server_idx ON peers (server);", - "CREATE TABLE IF NOT EXISTS desttokens ( dest TEXT NOT NULL, token TEXT NOT NULL, osps TEXT NOT NULL, openchanblknum INT NOT NULL, UNIQUE (dest, token) );", + "CREATE TABLE IF NOT EXISTS desttokens ( dest TEXT NOT NULL, token TEXT NOT NULL, osps TEXT NOT NULL, openchants INT NOT NULL, UNIQUE (dest, token) );", "CREATE TABLE IF NOT EXISTS chanmessages ( cid TEXT NOT NULL, seqnum INT NOT NULL, msg BYTEA, UNIQUE (cid, seqnum) );", "CREATE TABLE IF NOT EXISTS chanmigration ( cid TEXT NOT NULL REFERENCES channels (cid) ON DELETE CASCADE, toledger TEXT NOT NULL, deadline INT NOT NULL, onchainreq BYTEA, state INT NOT NULL, ts TIMESTAMPTZ NOT NULL, UNIQUE (cid, toledger) );", "CREATE INDEX IF NOT EXISTS mg_toledger_state_idx ON chanmigration (toledger, state);", diff --git a/test/e2e/channel_view.go b/test/e2e/channel_view.go index 8d603d4..706a4a0 100644 --- a/test/e2e/channel_view.go +++ b/test/e2e/channel_view.go @@ -86,17 +86,10 @@ func channelView(t *testing.T, tokenType entity.TokenType, tokenAddr string) { return } - // construct payment condition - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ - ctype.Hex2Addr(c1EthAddr), - ctype.Hex2Addr(c2EthAddr), - }) appChanID, err := c2.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) + ctype.Hex2Bytes(testapp.BooleanCondMockBin), + []byte{}, + 1005) if err != nil { t.Error(err) return diff --git a/test/e2e/e2e_crossnet_test.go b/test/e2e/e2e_crossnet_test.go index 4f03237..59820f4 100644 --- a/test/e2e/e2e_crossnet_test.go +++ b/test/e2e/e2e_crossnet_test.go @@ -4,6 +4,8 @@ package e2e import ( "os" + "path/filepath" + "strings" "testing" "time" @@ -319,12 +321,39 @@ func updateCrossNetTables() { names := []string{"o1", "o2", "o6", "o7", "o8", "o9"} for i := 0; i < 6; i++ { + cfgPath := materializeXnetConfig(names[i]) tf.StartProcess(outRootDir+"ospcli", "-profile", profiles[i], "-storedir", sStoreDir+"/"+addrs[i], "-dbupdate", "config-xnet", - "-file", xnetConfigDir+names[i]+".json", + "-file", cfgPath, "-logcolor", "-logprefix", "cli-"+names[i]).Wait() } } + +// materializeXnetConfig reads the checked-in xnet config template and +// substitutes the placeholder ERC20 token addresses with the actual deployed +// addresses captured at SetupOnChain time. The template uses the deterministic +// addresses that the original deployment order produced; once the deployer +// nonce sequence shifts (e.g. when test-fixture contracts are added or +// removed) the addresses no longer match, and routing lookup fails because +// channels are opened against the freshly-deployed token while xnet +// `net_token` mappings still point at stale addresses. +func materializeXnetConfig(name string) string { + src := xnetConfigDir + name + ".json" + raw, err := os.ReadFile(src) + if err != nil { + log.Fatalf("read xnet config %s: %v", src, err) + } + rewritten := strings.NewReplacer( + "f3ccc0a86f8451ab193011fbb408db2e38eaf10a", strings.ToLower(tokenAddrErc20), + "d332b06d3d64c957bc2f4a6cbf379b007f5507e1", strings.ToLower(tokenAddrNet1), + "adaa1a9ce0c4fe2018e3054f78c73947d2927a01", strings.ToLower(tokenAddrNet2), + ).Replace(string(raw)) + dst := filepath.Join(outRootDir, "xnet-"+name+".json") + if err := os.WriteFile(dst, []byte(rewritten), 0644); err != nil { + log.Fatalf("write xnet config %s: %v", dst, err) + } + return dst +} diff --git a/test/e2e/e2e_setup_test.go b/test/e2e/e2e_setup_test.go index c985aad..8f05f8f 100644 --- a/test/e2e/e2e_setup_test.go +++ b/test/e2e/e2e_setup_test.go @@ -31,6 +31,12 @@ func TestMain(m *testing.M) { // Allow client dials to use insecure transport for localhost during e2e, // avoiding CA mismatches with the server's self-signed localhost cert. os.Setenv("CELER_INSECURE_TLS", "1") + // Shrink the chain-confirmation slack past pay/withdraw deadlines so the + // timeout-and-sweep e2e flow runs in seconds instead of minutes. Production + // defaults (60s) are restored automatically when these env vars are unset. + os.Setenv("CELER_PAY_RECV_SAFE_MARGIN_S", "5") + os.Setenv("CELER_PAY_SEND_SAFE_MARGIN_S", "5") + os.Setenv("CELER_WITHDRAW_SAFE_MARGIN_S", "5") // Ensure DEBUG and above from app are visible in test output by default log.SetLevelByName("debug") if *reuse != "" { diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 2d0b26b..68ce692 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -92,9 +92,6 @@ func TestE2E(t *testing.T) { t.Run("e2e-grp3", func(t *testing.T) { t.Run("disputeEthPayWithVirtualContract", disputeEthPayWithVirtualContract) t.Run("disputeEthPayWithDeployedContract", disputeEthPayWithDeployedContract) - t.Run("disputeEthPaySrcOffline", disputeEthPaySrcOffline) - t.Run("disputeEthPayWithDeployedGomoku", disputeEthPayWithDeployedGomoku) - t.Run("disputePayBySigTimeoutWithDeployedContract", disputeEthPayBySigTimeoutWithDeployedContract) t.Run("settleErc20ChannelEmpty", settleErc20ChannelEmpty) t.Run("settleErc20ChannelOneSimplex", settleErc20ChannelOneSimplex) t.Run("settleErc20ChannelFullDuplex", settleErc20ChannelFullDuplex) diff --git a/test/e2e/multiosp_routing.go b/test/e2e/multiosp_routing.go index 4d8c7e0..f569b5b 100644 --- a/test/e2e/multiosp_routing.go +++ b/test/e2e/multiosp_routing.go @@ -4,6 +4,7 @@ package e2e import ( "testing" + "time" "github.com/celer-network/agent-pay/common" "github.com/celer-network/agent-pay/common/structs" @@ -418,16 +419,10 @@ func multiOspRouting(args ...*tf.ServerController) func(*testing.T) { } log.Info("------------------ test auto clear pays ------------------") - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ - ctype.Hex2Addr(c3EthAddr), - ctype.Hex2Addr(c5EthAddr), - }) appChanID, err := c3.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) + ctype.Hex2Bytes(testapp.BooleanCondMockBin), + []byte{}, + 1004) if err != nil { t.Error(err) return @@ -438,18 +433,16 @@ func multiOspRouting(args ...*tf.ServerController) func(*testing.T) { ArgsQueryFinalization: []byte{}, ArgsQueryOutcome: []byte{2}, } - timeout := uint64(3) + // Pay timeout in seconds. Short for fast CI. + timeout := uint64(5) p7, err := c3.SendPaymentWithBooleanConditions( c5EthAddr, sendAmt, entity.TokenType_ETH, tokenAddrEth, []*entity.Condition{c3Cond1}, timeout) if err != nil { t.Error(err) return } - payTime, err := c3.GetCurrentBlockNumber() - if err != nil { - t.Error(err) - return - } + // Pay deadline is unix timestamp (seconds) now; capture wall clock as the reference. + payTime := uint64(time.Now().Unix()) err = waitForPaymentPending(p7, c3, c5) if err != nil { t.Error(err) @@ -493,6 +486,7 @@ func multiOspRouting(args ...*tf.ServerController) func(*testing.T) { } log.Info("wait till pay expired") + // Wait past the pay deadline + receiver-side safe margin so SettleExpiredPays sees expiry. err = c3.WaitUntilDeadline(payTime + timeout + 10) if err != nil { t.Error(err) diff --git a/test/e2e/osp_webapi_test.go b/test/e2e/osp_webapi_test.go index a3c00e6..f703910 100644 --- a/test/e2e/osp_webapi_test.go +++ b/test/e2e/osp_webapi_test.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "os" - "strings" "testing" "time" @@ -79,7 +78,7 @@ func TestOSPWebApiRoutingBehavior(t *testing.T) { defer conn.Close() directResp, err := ospClient.SendToken(context.Background(), &webrpc.SendTokenRequest{ - TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, + TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, Destination: c1EthAddr, Amount: sendAmt, }) @@ -94,7 +93,7 @@ func TestOSPWebApiRoutingBehavior(t *testing.T) { } routedResp, err := ospClient.SendToken(context.Background(), &webrpc.SendTokenRequest{ - TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, + TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, Destination: c2EthAddr, Amount: sendAmt, }) @@ -153,7 +152,7 @@ func ospWebApiPaySubset(t *testing.T) { }() outgoingResp, err := ospClient.SendToken(context.Background(), &webrpc.SendTokenRequest{ - TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, + TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, Destination: c1EthAddr, Amount: sendAmt, }) @@ -170,13 +169,10 @@ func ospWebApiPaySubset(t *testing.T) { t.Fatal("OSP unexpectedly fetched outgoing pay via GetIncomingPaymentInfo") } - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ctype.Hex2Addr(c1EthAddr), ctype.Hex2Addr(ospEthAddr)}) appChanID, err := c1.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) + ctype.Hex2Bytes(testapp.BooleanCondMockBin), + []byte{}, + 1006) if err != nil { t.Fatal(err) } @@ -264,13 +260,13 @@ func ospWebApiAppSessionSubset(t *testing.T) { } defer conn.Close() - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ctype.Hex2Addr(c1EthAddr), ctype.Hex2Addr(ospEthAddr)}) + // This test exercises only the create→pay→reject→delete cycle on the OSP + // WebAPI; it never disputes or queries the registered contract, so the + // underlying bytecode is incidental. sessionResp, err := ospClient.CreateAppSessionOnVirtualContract(context.Background(), &webrpc.CreateAppSessionOnVirtualContractRequest{ - ContractBin: ctype.Bytes2Hex(testapp.AppCode), - ContractConstructor: ctype.Bytes2Hex(constructor), - Nonce: testapp.Nonce.Uint64(), - OnChainTimeout: testapp.Timeout.Uint64(), + ContractBin: testapp.BooleanCondMockBin, + ContractConstructor: "", + Nonce: 1007, }) if err != nil { t.Fatal(err) @@ -280,21 +276,13 @@ func ospWebApiAppSessionSubset(t *testing.T) { t.Fatal("CreateAppSessionOnVirtualContract returned empty session id") } - _, err = ospClient.GetStatusForAppSession(context.Background(), &webrpc.SessionID{SessionId: sessionID}) - if status.Code(err) == codes.Unimplemented { - t.Fatalf("GetStatusForAppSession still unimplemented: %v", err) - } - if err == nil || !strings.Contains(status.Convert(err).Message(), "app channel not deployed") { - t.Fatalf("GetStatusForAppSession error = %v, want app channel not deployed", err) - } - payResp, err := ospClient.SendConditionalPayment(context.Background(), &webrpc.SendConditionalPaymentRequest{ - TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, - Destination: c1EthAddr, - Amount: sendAmt, - TransferLogicType: entity.TransferFunctionType_BOOLEAN_AND, - Conditions: []*webrpc.Condition{{OnChainDeployed: false, ContractAddress: sessionID, IsFinalizedArgs: []byte{}, GetOutcomeArgs: []byte{2}}}, - Timeout: 100, + TokenInfo: &webrpc.TokenInfo{TokenType: entity.TokenType_ETH, TokenAddress: tokenAddrEth}, + Destination: c1EthAddr, + Amount: sendAmt, + TransferLogicType: entity.TransferFunctionType_BOOLEAN_AND, + Conditions: []*webrpc.Condition{{OnChainDeployed: false, ContractAddress: sessionID, IsFinalizedArgs: []byte{}, GetOutcomeArgs: []byte{2}}}, + Timeout: 100, }) if err != nil { t.Fatal(err) @@ -322,14 +310,6 @@ func ospWebApiAppSessionSubset(t *testing.T) { if err != nil { t.Fatal(err) } - - _, err = ospClient.GetStatusForAppSession(context.Background(), &webrpc.SessionID{SessionId: sessionID}) - if status.Code(err) == codes.Unimplemented { - t.Fatalf("GetStatusForAppSession after delete still unimplemented: %v", err) - } - if err == nil || !strings.Contains(status.Convert(err).Message(), "app channel not found") { - t.Fatalf("GetStatusForAppSession after delete error = %v, want app channel not found", err) - } } func waitForOspOutgoingPaymentCompletion(payID string, ospClient webrpc.WebApiClient, receiver *tf.ClientController) error { @@ -530,4 +510,4 @@ func assertOspWebApiOutgoingPayRouteShape(dal *storage.DAL, payID string, expect return fmt.Errorf("payment %s expected stored secret for routed hash-lock %x", payID, hashLock) } return nil -} \ No newline at end of file +} diff --git a/test/e2e/pay_dispute.go b/test/e2e/pay_dispute.go index 4ec0f0d..c9e21dc 100644 --- a/test/e2e/pay_dispute.go +++ b/test/e2e/pay_dispute.go @@ -1,20 +1,68 @@ // Copyright 2018-2025 Celer Network +// Conditional-pay dispute coverage. After AS-B trimmed the gaming +// state-machine machinery, the surviving "dispute" path is just: +// +// 1. send a conditional pay whose Condition references an IBooleanCond +// contract (either VIRTUAL_CONTRACT bytecode registered off-chain or +// a DEPLOYED_CONTRACT address); +// 2. for VIRTUAL_CONTRACT only, ensure the contract is on-chain by +// calling `GetBooleanOutcomeForAppSession` (the surviving deploy-on- +// query path through `AppClient.deployIfNeeded`); +// 3. invoke `PayResolver.resolvePaymentByConditions`, which calls +// `IBooleanCond.isFinalized(argsQueryFinalization)` and (only if true) +// `IBooleanCond.getOutcome(argsQueryOutcome)` on the deployed +// contract, and reverts with: +// - `"Nonexistent virtual address"` if step 2 was skipped for a +// VIRTUAL_CONTRACT condition; +// - `"Condition is not finalized"` if isFinalized returns false. +// 4. assert the resulting on-chain pay amount (full when both bytes are +// non-zero) or that the resolve reverted as expected. +// +// `BooleanCondMock` (deployed from `agent-pay-contracts/src/helper/`) is the +// fixture: a single byte argsQuery where any non-zero value → true, +// 0x00 → false, empty → true for isFinalized but false for getOutcome. +// +// Three on-chain protocol paths are covered (one per dispute call): +// +// - **Symmetric pass** — argsQueryFinalization == argsQueryOutcome == 0x01 +// (`runVirtualContractScenario` / `runDeployedContractScenario` with +// expectPaid=true): isFinalized=true, getOutcome=true → registry +// resolves to full amount. +// - **Symmetric not-finalized** — both bytes 0x00 (same helpers with +// expectPaid=false): isFinalized=false → PayResolver reverts with +// "Condition is not finalized" before getOutcome is ever called. +// - **BOOLEAN_AND short-circuit** — finalize=0x01 + outcome=0x00 +// (`run{Virtual,Deployed}ContractFalseOutcomeScenario`): isFinalized=true +// but getOutcome=false → registry resolves to amount=0 with no revert. +// This is the path PayResolver takes when at least one BOOLEAN_AND +// condition is finalized-but-false. +// +// Two negative scenarios pin down on-chain prerequisites for VIRTUAL_CONTRACT: +// - `runVirtualContractResolveBeforeDeploy`: skipping step 2 reverts with +// "Nonexistent virtual address"; +// - `runVirtualContractParallelDeploy`: concurrent deploy-on-query calls +// converge on a single deploy tx (the `AppChannel.mu` mutex prevents +// duplicate submissions that would revert with VirtContractResolver's +// "Current real address is not 0" guard); also asserts the +// VirtContractResolver `Deploy` event log has exactly one entry for the +// virtual address. + package e2e import ( - "bytes" "fmt" - "math/big" + "strings" "testing" "github.com/celer-network/agent-pay/app" + "github.com/celer-network/agent-pay/chain/channel-eth-go/virtresolver" "github.com/celer-network/agent-pay/ctype" "github.com/celer-network/agent-pay/entity" tf "github.com/celer-network/agent-pay/testing" "github.com/celer-network/agent-pay/testing/testapp" "github.com/celer-network/goutils/log" - "google.golang.org/protobuf/proto" + "github.com/ethereum/go-ethereum/accounts/abi/bind" ) func disputeEthPayWithVirtualContract(t *testing.T) { @@ -31,1077 +79,528 @@ func disputeEthPayWithDeployedContract(t *testing.T) { disputePayWithDeployedContract(t, entity.TokenType_ETH, tokenAddrEth) } -func disputeEthPayWithDeployedGomoku(t *testing.T) { - log.Info("============== start test disputeEthPayWithDeployedGomoku ==============") - defer log.Info("============== end test disputeEthPayWithDeployedGomoku ==============") - t.Parallel() - disputePayWithDeployedGomoku(t, entity.TokenType_ETH, tokenAddrEth) -} - -func disputeEthPaySrcOffline(t *testing.T) { - log.Info("============== start test disputeEthPaySrcOffline ==============") - defer log.Info("============== end test disputeEthPaySrcOffline ==============") - t.Parallel() - disputePaySrcOffline(t, entity.TokenType_ETH, tokenAddrEth) -} - +// disputePayWithVirtualContract drives the VIRTUAL_CONTRACT path: register +// `BooleanCondMock` bytecode off-chain, send a conditional pay against the +// deterministic virtual address, then resolve on-chain. The first scenario +// uses argsQueryOutcome=0x01 (getOutcome → true) and asserts the receiver +// pulls the full amount; the second uses 0x00 (getOutcome → false) and +// asserts the registry stays at zero. func disputePayWithVirtualContract(t *testing.T, tokenType entity.TokenType, tokenAddr string) { - ks, addrs, err := tf.CreateAccountsWithBalance(2, accountBalance) - if err != nil { - t.Error(err) - return - } - log.Infoln("create accounts for disputePayWithVirtualContract token", tokenAddr, addrs) - if tokenAddr != tokenAddrEth { - err = tf.FundAccountsWithErc20(tokenAddr, addrs, accountBalance) - if err != nil { - t.Error(err) - return - } - } - c1KeyStore := ks[0] - c2KeyStore := ks[1] - c1EthAddr := addrs[0] - c2EthAddr := addrs[1] - - c1, err := tf.StartC1WithoutProxy(c1KeyStore) - if err != nil { - t.Error(err) - return - } - defer c1.Kill() - - c2, err := tf.StartC2WithoutProxy(c2KeyStore) - if err != nil { - t.Error(err) - return - } - defer c2.Kill() - - _, err = c1.OpenChannel(c1EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return - } - _, err = c2.OpenChannel(c2EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return - } - - err = c1.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) + c1, c2, _, c2EthAddr, cleanup, err := setupTwoClientChannels(tokenType, tokenAddr) if err != nil { t.Error(err) return } + defer cleanup() - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ - ctype.Hex2Addr(c1EthAddr), - ctype.Hex2Addr(c2EthAddr), - }) - appChanID, err := c1.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } + bytecode := testapp.BooleanCondMockBin + constructor := []byte{} - appChanID2, err := c2.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } - if appChanID != appChanID2 { - err = fmt.Errorf("appChanID does not match") - if err != nil { - t.Error(err) - return - } - } - - c1Cond := &entity.Condition{ - ConditionType: entity.ConditionType_VIRTUAL_CONTRACT, - VirtualContractAddress: ctype.Hex2Bytes(appChanID), - ArgsQueryFinalization: []byte{}, - ArgsQueryOutcome: []byte{2}, - } - - payID, err := c1.SendPaymentWithBooleanConditions( - c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{c1Cond}, 100) - if err != nil { - t.Error(err) - return - } - - err = waitForPaymentPending(payID, c1, c2) - if err != nil { + // Three distinct nonces so the three scenarios get different virtual + // addresses and don't collide on chain. + if err := runVirtualContractScenario(c1, c2, c2EthAddr, tokenType, tokenAddr, + ctype.Hex2Bytes(bytecode), constructor, 1, []byte{0x01}, true); err != nil { t.Error(err) return } - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "1", - initialBalance) - if err != nil { + if err := runVirtualContractScenario(c1, c2, c2EthAddr, tokenType, tokenAddr, + ctype.Hex2Bytes(bytecode), constructor, 2, []byte{0x00}, false); err != nil { t.Error(err) return } - err = c2.AssertBalance( - tokenAddr, - initialBalance, - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { + // BOOLEAN_AND short-circuit: isFinalized=true, getOutcome=false. The pay + // resolves on-chain to amount=0 (no revert) — the third protocol-supported + // outcome that the symmetric `runVirtualContractScenario` calls above don't + // reach. argsQueryFinalization=0x01 → isFinalized=true; argsQueryOutcome=0x00 + // → getOutcome=false → BOOLEAN_AND short-circuits to amount=0. + if err := runVirtualContractFalseOutcomeScenario(c1, c2, c2EthAddr, tokenType, tokenAddr, + ctype.Hex2Bytes(bytecode), constructor, 3); err != nil { t.Error(err) return } - - appState := testapp.GetAppState(2, testapp.Nonce.Uint64()) - c1Sig, _ := c1.SignData(appState) - c2Sig, _ := c2.SignData(appState) - stateProof := &app.StateProof{AppState: appState} - stateProof.Sigs = append(stateProof.Sigs, c1Sig) - stateProof.Sigs = append(stateProof.Sigs, c2Sig) - serializedStateProof, err := proto.Marshal(stateProof) - if err != nil { + // Negative scenario: resolving a VIRTUAL_CONTRACT pay before the virtual + // contract is deployed must fail at PayResolver. This documents the + // deploy-before-resolve contract enforced on-chain by VirtContractResolver. + if err := runVirtualContractResolveBeforeDeploy(c1, c2, c2EthAddr, tokenType, tokenAddr, + ctype.Hex2Bytes(bytecode), constructor, 4); err != nil { t.Error(err) return } - - done := make(chan bool) - go tf.AdvanceBlocksUntilDone(done) - - err = c2.SettleAppChannel(appChanID, serializedStateProof) - if err != nil { + // Concurrency scenario: N parallel deploy-on-query calls for the same + // virtual contract must converge on a single on-chain deploy tx. The + // AppChannel.mu mutex serializes deployIfNeeded; a regression that + // removes that locking would either waste a deploy tx or revert the + // second submission with VirtContractResolver's "Current real address + // is not 0" guard. The test also asserts exactly one Deploy event was + // emitted by VirtContractResolver, which strengthens "no caller fails" + // to "exactly one tx submitted". + if err := runVirtualContractParallelDeploy(c2, ctype.Hex2Bytes(bytecode), constructor, 5); err != nil { t.Error(err) return } +} - finalized, result, err := c2.GetAppChannelBooleanOutcome(appChanID, []byte{2}) +// disputePayWithDeployedContract drives the DEPLOYED_CONTRACT path against +// the `BooleanCondMock` instance deployed in `setup_onchain.go`. +func disputePayWithDeployedContract(t *testing.T, tokenType entity.TokenType, tokenAddr string) { + c1, c2, _, c2EthAddr, cleanup, err := setupTwoClientChannels(tokenType, tokenAddr) if err != nil { t.Error(err) return } - if !finalized { - err = fmt.Errorf("condition not finalized") - if err != nil { - t.Error(err) - return - } - } - if !result { - err = fmt.Errorf("result not satisfied") - if err != nil { - t.Error(err) - return - } - } - sleep(1) + defer cleanup() - amount, _, err := c2.SettleConditionalPayOnChain(payID) - if err != nil { - t.Error(err) + mockAddr, ok := appAddrMap["BooleanCondMock"] + if !ok { + t.Errorf("BooleanCondMock address not found in appAddrMap") return } - if amount != "1" { - err = fmt.Errorf("pay result not match. expect 1 got %s", amount) - if err != nil { - t.Error(err) - return - } - } - err = c2.SettleOnChainResolvedPay(payID) - if err != nil { + if err := runDeployedContractScenario(c1, c2, c2EthAddr, tokenType, tokenAddr, + mockAddr, []byte{0x01}, true); err != nil { t.Error(err) return } - sleep(1) - done <- true - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "0", - tf.AddAmtStr(initialBalance, "1")) - if err != nil { + if err := runDeployedContractScenario(c1, c2, c2EthAddr, tokenType, tokenAddr, + mockAddr, []byte{0x00}, false); err != nil { t.Error(err) return } - err = c2.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "1"), - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { + // BOOLEAN_AND short-circuit: argsQueryFinalization=0x01 (isFinalized=true) + // + argsQueryOutcome=0x00 (getOutcome=false) → registry resolves to + // amount=0 with no revert. Same protocol path as the virtual-contract + // false-outcome scenario above. + if err := runDeployedContractFalseOutcomeScenario(c1, c2, c2EthAddr, tokenType, tokenAddr, mockAddr); err != nil { t.Error(err) return } } -func disputePayWithDeployedContract(t *testing.T, tokenType entity.TokenType, tokenAddr string) { - ks, addrs, err := tf.CreateAccountsWithBalance(2, accountBalance) - if err != nil { - t.Error(err) - return - } - log.Infoln("create accounts for disputePayWithDeployedContract token", tokenAddr, addrs) - if tokenAddr != tokenAddrEth { - err = tf.FundAccountsWithErc20(tokenAddr, addrs, accountBalance) - if err != nil { - t.Error(err) - return - } - } - c1KeyStore := ks[0] - c2KeyStore := ks[1] - c1EthAddr := addrs[0] - c2EthAddr := addrs[1] +func runVirtualContractScenario( + c1, c2 *tf.ClientController, + c2EthAddr string, + tokenType entity.TokenType, + tokenAddr string, + bytecode []byte, + constructor []byte, + nonce uint64, + queryBytes []byte, + expectPaid bool, +) error { + log.Infof("virtual-contract scenario: nonce=%d query=%x expectPaid=%v", nonce, queryBytes, expectPaid) - c1, err := tf.StartC1WithoutProxy(c1KeyStore) + appChanID, err := c1.NewAppChannelOnVirtualContract(bytecode, constructor, nonce) if err != nil { - t.Error(err) - return + return fmt.Errorf("c1 NewAppChannelOnVirtualContract: %w", err) } - defer c1.Kill() - - c2, err := tf.StartC2WithoutProxy(c2KeyStore) + appChanID2, err := c2.NewAppChannelOnVirtualContract(bytecode, constructor, nonce) if err != nil { - t.Error(err) - return + return fmt.Errorf("c2 NewAppChannelOnVirtualContract: %w", err) } - defer c2.Kill() - - _, err = c1.OpenChannel(c1EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return + if appChanID != appChanID2 { + return fmt.Errorf("virtual-contract address mismatch: c1=%s c2=%s", appChanID, appChanID2) } - _, err = c2.OpenChannel(c2EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return + + // Set ArgsQueryFinalization symmetrically with ArgsQueryOutcome so the + // on-chain `isFinalized` is called with the same non-empty bytes as the + // off-chain assertion below — i.e. for queryBytes=0x00 the negative case + // reaches PayResolver via isFinalized=false (the protocol-correct rejection) + // rather than implicitly via an empty-bytes quirk. + cond := &entity.Condition{ + ConditionType: entity.ConditionType_VIRTUAL_CONTRACT, + VirtualContractAddress: ctype.Hex2Bytes(appChanID), + ArgsQueryFinalization: queryBytes, + ArgsQueryOutcome: queryBytes, } - err = c1.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) + // Trigger the deploy-on-query path before on-chain pay resolution. + // PayResolver.resolvePaymentByConditions calls + // VirtContractResolver.resolve(virtAddr), which reverts with "Nonexistent + // virtual address" if the virtual contract has never been deployed. The + // off-chain GetBooleanOutcomeForAppSession path runs `deployIfNeeded` + // before querying IBooleanCond, so calling it here is enough to ensure + // the virtual address has bytecode by the time the resolve tx lands. + finalized, outcome, err := c2.GetAppChannelBooleanOutcome(appChanID, queryBytes) if err != nil { - t.Error(err) - return + return fmt.Errorf("GetAppChannelBooleanOutcome: %w", err) } - err = c2.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - t.Error(err) - return + wantOutcome := expectPaid + wantFinalized := expectPaid + if finalized != wantFinalized || outcome != wantOutcome { + return fmt.Errorf("BooleanCondMock query %x: finalized=%v outcome=%v, want finalized=%v outcome=%v", + queryBytes, finalized, outcome, wantFinalized, wantOutcome) } - players := []string{c1EthAddr, c2EthAddr} - appChanID, err := c1.NewAppChannelOnDeployedContract( - testapp.ContractAddr, - testapp.Nonce.Uint64(), - players, - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } + return runDisputeAndAssert(c1, c2, c2EthAddr, tokenType, tokenAddr, cond, expectPaid) +} - appChanID2, err := c2.NewAppChannelOnDeployedContract( - testapp.ContractAddr, - testapp.Nonce.Uint64(), - players, - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } - if appChanID != appChanID2 { - err = fmt.Errorf("appChanID does not match") - if err != nil { - t.Error(err) - return - } - } +func runDeployedContractScenario( + c1, c2 *tf.ClientController, + c2EthAddr string, + tokenType entity.TokenType, + tokenAddr string, + mockAddr ctype.Addr, + queryBytes []byte, + expectPaid bool, +) error { + log.Infof("deployed-contract scenario: addr=%x query=%x expectPaid=%v", mockAddr, queryBytes, expectPaid) - sessionQuery := &app.SessionQuery{ - Session: ctype.Hex2Bytes(appChanID), - Query: []byte{2}, - } - serializedSessionQuery, err := proto.Marshal(sessionQuery) - c1Cond := &entity.Condition{ + cond := &entity.Condition{ ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, - DeployedContractAddress: ctype.Hex2Bytes(testapp.ContractAddr), - ArgsQueryFinalization: ctype.Hex2Bytes(appChanID), - ArgsQueryOutcome: serializedSessionQuery, - } - payID, err := c1.SendPaymentWithBooleanConditions( - c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{c1Cond}, 100) - if err != nil { - t.Error(err) - return - } - - err = waitForPaymentPending(payID, c1, c2) - if err != nil { - t.Error(err) - return + DeployedContractAddress: mockAddr.Bytes(), + ArgsQueryFinalization: queryBytes, + ArgsQueryOutcome: queryBytes, } + return runDisputeAndAssert(c1, c2, c2EthAddr, tokenType, tokenAddr, cond, expectPaid) +} - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "1", - initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - initialBalance, - "0", - tf.AddAmtStr(initialBalance, "-1")) +// runDisputeAndAssert sends a conditional pay with the given `cond`, drives +// it through on-chain resolution via PayResolver, and asserts the result. +// +// `expectPaid=true` means both isFinalized and getOutcome return true — the +// pay resolves to the full amount. +// +// `expectPaid=false` means both isFinalized and getOutcome return false (the +// scenario sets ArgsQueryFinalization=ArgsQueryOutcome=0x00). PayResolver +// requires isFinalized=true, so the on-chain resolve must revert with +// "Condition is not finalized" — pay never lands in the registry. The +// alternative "isFinalized=true, getOutcome=false" path (BOOLEAN_AND with a +// false-outcome condition resolving to amount=0) is implicitly covered by +// the wire format and is not exercised here to keep this scenario aligned +// with the on-chain contract's strict isFinalized requirement. +func runDisputeAndAssert( + c1, c2 *tf.ClientController, + c2EthAddr string, + tokenType entity.TokenType, + tokenAddr string, + cond *entity.Condition, + expectPaid bool, +) error { + payID, err := c1.SendPaymentWithBooleanConditions( + c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{cond}, 100) if err != nil { - t.Error(err) - return + return fmt.Errorf("SendPaymentWithBooleanConditions: %w", err) } - - log.Info("============ Test generic channel onchain API =============") - appState := testapp.GetAppState(3, testapp.Nonce.Uint64()) - c1Sig, _ := c1.SignData(appState) - c2Sig, _ := c2.SignData(appState) - stateProof := &app.StateProof{AppState: appState} - stateProof.Sigs = append(stateProof.Sigs, c1Sig) - stateProof.Sigs = append(stateProof.Sigs, c2Sig) - serializedStateProof, err := proto.Marshal(stateProof) - if err != nil { - t.Error(err) - return + if err := waitForPaymentPending(payID, c1, c2); err != nil { + return fmt.Errorf("waitForPaymentPending: %w", err) } done := make(chan bool) go tf.AdvanceBlocksUntilDone(done) + defer func() { done <- true }() - err = c2.SettleAppChannel(appChanID, serializedStateProof) - if err != nil { - t.Error(err) - return - } - - state, err := c2.GetAppChannelState(appChanID, 0) - if err != nil { - t.Error(err) - return - } - if state == nil || big.NewInt(0).SetBytes(state).Cmp(big.NewInt(3)) != 0 { - err = fmt.Errorf("incorrect state %x", state) - if err != nil { - t.Error(err) - return + amount, _, err := c2.SettleConditionalPayOnChain(payID) + if !expectPaid { + if err == nil { + return fmt.Errorf("SettleConditionalPayOnChain unexpectedly succeeded for not-finalized condition (amount=%s)", amount) } + if !strings.Contains(err.Error(), "Condition is not finalized") { + return fmt.Errorf("SettleConditionalPayOnChain error = %v, want substring %q", err, "Condition is not finalized") + } + return nil } - - finalizedTime, err := c1.GetAppChannelSettleFinalizedTime(appChanID) if err != nil { - t.Error(err) - return + return fmt.Errorf("SettleConditionalPayOnChain: %w", err) } - err = c1.WaitUntilDeadline(finalizedTime) - if err != nil { - t.Error(err) - return + if amount != sendAmt { + return fmt.Errorf("on-chain pay amount = %s, want %s (expectPaid=true)", amount, sendAmt) } + return nil +} - err = c1.ApplyAppChannelAction(appChanID, []byte{2}) - if err != nil { - t.Error(err) - return - } +// runDeployedContractFalseOutcomeScenario is the DEPLOYED_CONTRACT counterpart +// to `runVirtualContractFalseOutcomeScenario`: argsQueryFinalization=0x01 + +// argsQueryOutcome=0x00 against the on-chain BooleanCondMock instance from +// `setup_onchain.go` resolves to amount=0 (BOOLEAN_AND short-circuit, no +// revert). +func runDeployedContractFalseOutcomeScenario( + c1, c2 *tf.ClientController, + c2EthAddr string, + tokenType entity.TokenType, + tokenAddr string, + mockAddr ctype.Addr, +) error { + log.Infof("deployed-contract false-outcome scenario: addr=%x", mockAddr) - finalized, result, err := c2.GetAppChannelBooleanOutcome(appChanID, []byte{2}) - if err != nil { - t.Error(err) - return - } - if !finalized { - err = fmt.Errorf("condition not finalized") - if err != nil { - t.Error(err) - return - } - } - if !result { - err = fmt.Errorf("result not satisfied") - if err != nil { - t.Error(err) - return - } + cond := &entity.Condition{ + ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, + DeployedContractAddress: mockAddr.Bytes(), + ArgsQueryFinalization: []byte{0x01}, + ArgsQueryOutcome: []byte{0x00}, } - amount, _, err := c2.SettleConditionalPayOnChain(payID) + payID, err := c1.SendPaymentWithBooleanConditions( + c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{cond}, 100) if err != nil { - t.Error(err) - return + return fmt.Errorf("SendPaymentWithBooleanConditions: %w", err) } - if amount != "1" { - err = fmt.Errorf("pay result not match. expect 1 got %s", amount) - if err != nil { - t.Error(err) - return - } + if err := waitForPaymentPending(payID, c1, c2); err != nil { + return fmt.Errorf("waitForPaymentPending: %w", err) } - err = c2.SettleOnChainResolvedPay(payID) - if err != nil { - t.Error(err) - return - } - sleep(1) - done <- true + done := make(chan bool) + go tf.AdvanceBlocksUntilDone(done) + defer func() { done <- true }() - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "0", - tf.AddAmtStr(initialBalance, "1")) + amount, _, err := c2.SettleConditionalPayOnChain(payID) if err != nil { - t.Error(err) - return + return fmt.Errorf("SettleConditionalPayOnChain: %w", err) } - err = c2.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "1"), - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { - t.Error(err) - return + if amount != "0" { + return fmt.Errorf("deployed-contract BOOLEAN_AND-with-false-outcome amount = %s, want 0", amount) } + log.Infof("deployed-contract false-outcome scenario correctly resolved to amount=0") + return nil } -func disputePaySrcOffline(t *testing.T, tokenType entity.TokenType, tokenAddr string) { - ks, addrs, err := tf.CreateAccountsWithBalance(2, accountBalance) - if err != nil { - t.Error(err) - return - } - log.Infoln("create accounts for disputePaySrcOffline token", tokenAddr, addrs) - if tokenAddr != tokenAddrEth { - err = tf.FundAccountsWithErc20(tokenAddr, addrs, accountBalance) - if err != nil { - t.Error(err) - return - } - } - c1KeyStore := ks[0] - c2KeyStore := ks[1] - c1EthAddr := addrs[0] - c2EthAddr := addrs[1] - - c1, err := tf.StartC1WithoutProxy(c1KeyStore) - if err != nil { - t.Error(err) - return - } - defer c1.Kill() - - c2, err := tf.StartC2WithoutProxy(c2KeyStore) - if err != nil { - t.Error(err) - return - } - defer c2.Kill() +// runVirtualContractFalseOutcomeScenario covers the third protocol-supported +// outcome that the symmetric `runVirtualContractScenario` paths don't reach: +// `(isFinalized=true, getOutcome=false)` resolves on-chain to amount=0 via +// PayResolver's BOOLEAN_AND short-circuit. argsQueryFinalization=0x01 makes +// `BooleanCondMock.isFinalized(0x01)` return true so the resolve doesn't +// revert; argsQueryOutcome=0x00 makes `getOutcome(0x00)` return false so the +// pay registry stays at amount=0. Pre-deploys via the deploy-on-query path so +// the resolve doesn't hit "Nonexistent virtual address". +func runVirtualContractFalseOutcomeScenario( + c1, c2 *tf.ClientController, + c2EthAddr string, + tokenType entity.TokenType, + tokenAddr string, + bytecode []byte, + constructor []byte, + nonce uint64, +) error { + log.Infof("virtual-contract false-outcome scenario: nonce=%d", nonce) - _, err = c1.OpenChannel(c1EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) + appChanID, err := c1.NewAppChannelOnVirtualContract(bytecode, constructor, nonce) if err != nil { - t.Error(err) - return + return fmt.Errorf("c1 NewAppChannelOnVirtualContract: %w", err) } - _, err = c2.OpenChannel(c2EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return + if _, err := c2.NewAppChannelOnVirtualContract(bytecode, constructor, nonce); err != nil { + return fmt.Errorf("c2 NewAppChannelOnVirtualContract: %w", err) } - err = c1.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - t.Error(err) - return - } - - players := []string{c1EthAddr, c2EthAddr} - - log.Infoln("================== First cond pay and app settle =======================") - appChanID, err := c1.NewAppChannelOnDeployedContract( - testapp.ContractAddr, - 666, - players, - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return + // Trigger deploy-on-query before the on-chain resolve so PayResolver + // doesn't revert with "Nonexistent virtual address". + if _, _, err := c2.GetAppChannelBooleanOutcome(appChanID, []byte{0x01}); err != nil { + return fmt.Errorf("GetAppChannelBooleanOutcome (deploy trigger): %w", err) } - sessionQuery := &app.SessionQuery{ - Session: ctype.Hex2Bytes(appChanID), - Query: []byte{2}, - } - serializedSessionQuery, err := proto.Marshal(sessionQuery) cond := &entity.Condition{ - ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, - DeployedContractAddress: ctype.Hex2Bytes(testapp.ContractAddr), - ArgsQueryFinalization: ctype.Hex2Bytes(appChanID), - ArgsQueryOutcome: serializedSessionQuery, - } - payID1, err := c1.SendPaymentWithBooleanConditions( - c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{cond}, 100) - if err != nil { - t.Error(err) - return - } - - err = waitForPaymentPending(payID1, c1, c2) - if err != nil { - t.Error(err) - return + ConditionType: entity.ConditionType_VIRTUAL_CONTRACT, + VirtualContractAddress: ctype.Hex2Bytes(appChanID), + ArgsQueryFinalization: []byte{0x01}, + ArgsQueryOutcome: []byte{0x00}, } - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "1", - initialBalance) + payID, err := c1.SendPaymentWithBooleanConditions( + c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{cond}, 100) if err != nil { - t.Error(err) - return + return fmt.Errorf("SendPaymentWithBooleanConditions: %w", err) } - err = c2.AssertBalance( - tokenAddr, - initialBalance, - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { - t.Error(err) - return - } - - appState := testapp.GetAppState(2, 666) - c1Sig, _ := c1.SignData(appState) - c2Sig, _ := c2.SignData(appState) - stateProof := &app.StateProof{AppState: appState} - stateProof.Sigs = append(stateProof.Sigs, c1Sig) - stateProof.Sigs = append(stateProof.Sigs, c2Sig) - serializedStateProof, err := proto.Marshal(stateProof) - if err != nil { - t.Error(err) - return + if err := waitForPaymentPending(payID, c1, c2); err != nil { + return fmt.Errorf("waitForPaymentPending: %w", err) } done := make(chan bool) go tf.AdvanceBlocksUntilDone(done) + defer func() { done <- true }() - err = c1.SettleAppChannel(appChanID, serializedStateProof) + amount, _, err := c2.SettleConditionalPayOnChain(payID) if err != nil { - t.Error(err) - return + return fmt.Errorf("SettleConditionalPayOnChain: %w", err) } - done <- true - - finalized, result, err := c1.GetAppChannelBooleanOutcome(appChanID, []byte{2}) - if err != nil { - t.Error(err) - return - } - if !finalized { - err = fmt.Errorf("condition not finalized") - if err != nil { - t.Error(err) - return - } + if amount != "0" { + return fmt.Errorf("BOOLEAN_AND-with-false-outcome on-chain pay amount = %s, want 0 (registry should stay at zero, not revert)", amount) } - if !result { - err = fmt.Errorf("result not satisfied") - if err != nil { - t.Error(err) - return - } - } - c1.DeleteAppChannel(appChanID) + log.Infof("false-outcome scenario correctly resolved to amount=0") + return nil +} - log.Infoln("================== Second cond pay and app settle =======================") - appChanID, err = c1.NewAppChannelOnDeployedContract( - testapp.ContractAddr, - 999, - players, - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } +// runVirtualContractResolveBeforeDeploy registers a virtual condition +// contract (so the off-chain Condition is well-formed) but deliberately skips +// the deploy-on-query step, then sends a conditional pay against that +// undeployed virtual address and asserts that PayResolver rejects the resolve +// with "Nonexistent virtual address". This pins down the on-chain +// deploy-before-resolve contract that the positive scenarios above rely on. +func runVirtualContractResolveBeforeDeploy( + c1, c2 *tf.ClientController, + c2EthAddr string, + tokenType entity.TokenType, + tokenAddr string, + bytecode []byte, + constructor []byte, + nonce uint64, +) error { + log.Infof("virtual-contract negative scenario (resolve-before-deploy): nonce=%d", nonce) - sessionQuery = &app.SessionQuery{ - Session: ctype.Hex2Bytes(appChanID), - Query: []byte{2}, - } - serializedSessionQuery, err = proto.Marshal(sessionQuery) - cond = &entity.Condition{ - ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, - DeployedContractAddress: ctype.Hex2Bytes(testapp.ContractAddr), - ArgsQueryFinalization: ctype.Hex2Bytes(appChanID), - ArgsQueryOutcome: serializedSessionQuery, - } - payID2, err := c1.SendPaymentWithBooleanConditions( - c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{cond}, 100) + appChanID, err := c1.NewAppChannelOnVirtualContract(bytecode, constructor, nonce) if err != nil { - t.Error(err) - return + return fmt.Errorf("c1 NewAppChannelOnVirtualContract: %w", err) } - - err = waitForPaymentPending(payID2, c1, c2) - if err != nil { - t.Error(err) - return + if _, err := c2.NewAppChannelOnVirtualContract(bytecode, constructor, nonce); err != nil { + return fmt.Errorf("c2 NewAppChannelOnVirtualContract: %w", err) } - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-2"), - "2", - initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - initialBalance, - "0", - tf.AddAmtStr(initialBalance, "-2")) - if err != nil { - t.Error(err) - return + cond := &entity.Condition{ + ConditionType: entity.ConditionType_VIRTUAL_CONTRACT, + VirtualContractAddress: ctype.Hex2Bytes(appChanID), + ArgsQueryOutcome: []byte{0x01}, } - appState = testapp.GetAppState(2, 999) - c1Sig, _ = c1.SignData(appState) - c2Sig, _ = c2.SignData(appState) - stateProof = &app.StateProof{AppState: appState} - stateProof.Sigs = append(stateProof.Sigs, c1Sig) - stateProof.Sigs = append(stateProof.Sigs, c2Sig) - serializedStateProof, err = proto.Marshal(stateProof) + payID, err := c1.SendPaymentWithBooleanConditions( + c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{cond}, 100) if err != nil { - t.Error(err) - return + return fmt.Errorf("SendPaymentWithBooleanConditions: %w", err) } - - go tf.AdvanceBlocksUntilDone(done) - - err = c1.SettleAppChannel(appChanID, serializedStateProof) - if err != nil { - t.Error(err) - return + if err := waitForPaymentPending(payID, c1, c2); err != nil { + return fmt.Errorf("waitForPaymentPending: %w", err) } - done <- true - finalized, result, err = c1.GetAppChannelBooleanOutcome(appChanID, []byte{2}) - if err != nil { - t.Error(err) - return - } - if !finalized { - err = fmt.Errorf("condition not finalized") - if err != nil { - t.Error(err) - return - } - } - if !result { - err = fmt.Errorf("result not satisfied") - if err != nil { - t.Error(err) - return - } - } - sleep(1) - c1.DeleteAppChannel(appChanID) + done := make(chan bool) + go tf.AdvanceBlocksUntilDone(done) + defer func() { done <- true }() - log.Infoln("================== Resolve pay onchain =======================") - amount, _, err := c1.SettleConditionalPayOnChain(payID1) - if err != nil { - t.Error(err) - return + // Intentionally skip GetAppChannelBooleanOutcome — the virtual contract + // must remain undeployed for this scenario. + _, _, err = c2.SettleConditionalPayOnChain(payID) + if err == nil { + return fmt.Errorf("SettleConditionalPayOnChain unexpectedly succeeded against undeployed virtual contract") } - if amount != "1" { - err = fmt.Errorf("pay result not match. expect 1 got %s", amount) - if err != nil { - t.Error(err) - return - } + if !strings.Contains(err.Error(), "Nonexistent virtual address") { + return fmt.Errorf("SettleConditionalPayOnChain error = %v, want substring %q", err, "Nonexistent virtual address") } + log.Infof("resolve-before-deploy correctly rejected: %v", err) + return nil +} - amount, _, err = c1.SettleConditionalPayOnChain(payID2) - if err != nil { - t.Error(err) - return - } - if amount != "1" { - err = fmt.Errorf("pay result not match. expect 1 got %s", amount) - if err != nil { - t.Error(err) - return +// runVirtualContractParallelDeploy fires N concurrent deploy-on-query calls +// against a freshly-registered virtual contract and asserts: +// +// - Every concurrent `GetBooleanOutcome` call returns `(true, true, nil)`. +// - Exactly one VirtContractResolver `Deploy` event was emitted for the +// virtual address. This is the stronger invariant the mutex is supposed +// to guarantee: "exactly one deploy tx submitted," not just "no caller +// observed an error." +// +// Without the mutex, at least one goroutine would submit a duplicate deploy +// tx and one of two things would happen: VirtContractResolver reverts the +// second one with "Current real address is not 0" (the first goroutine sees +// an error from `SubmitWaitMined`) or the second tx lands and a Deploy event +// count of 2 would surface here. With the mutex, the first goroutine deploys, +// every other goroutine sees the cached `deployedAddr` and returns without +// a tx. +func runVirtualContractParallelDeploy( + c *tf.ClientController, + bytecode []byte, + constructor []byte, + nonce uint64, +) error { + log.Infof("virtual-contract parallel-deploy scenario: nonce=%d", nonce) + + appChanID, err := c.NewAppChannelOnVirtualContract(bytecode, constructor, nonce) + if err != nil { + return fmt.Errorf("NewAppChannelOnVirtualContract: %w", err) + } + + const workers = 4 + errs := make(chan error, workers) + for i := 0; i < workers; i++ { + go func(idx int) { + f, o, e := c.GetAppChannelBooleanOutcome(appChanID, []byte{0x01}) + if e != nil { + errs <- fmt.Errorf("parallel GetAppChannelBooleanOutcome[%d]: %w", idx, e) + return + } + if !f || !o { + errs <- fmt.Errorf("parallel GetAppChannelBooleanOutcome[%d]: finalized=%v outcome=%v, want true/true", + idx, f, o) + return + } + errs <- nil + }(i) + } + for i := 0; i < workers; i++ { + if e := <-errs; e != nil { + return e } } - log.Infoln("================== Kill C1 =======================") - c1.KillWithoutRemovingKeystore() - - log.Infoln("================== Settle onchain resolved pays =======================") - err = c2.SettleOnChainResolvedPay(payID1) - if err != nil { - t.Error(err) - return - } - err = c2.SettleOnChainResolvedPay(payID2) - if err != nil { - t.Error(err) - return - } - sleep(7) - - log.Infoln("================== Restart C1 =======================") - c1, err = tf.StartC1WithoutProxy(c1KeyStore) + // Strengthen the regression test: assert exactly one Deploy event was + // emitted for the virtual address. A buggy implementation that, e.g., + // serialized via a coarser-grained lock that nonetheless allowed a + // duplicate submission and swallowed the resulting revert in the second + // goroutine would fail this check. + virtAddr := app.GetVirtualAddress(bytecode, constructor, nonce) + var virt32 [32]byte + copy(virt32[:], virtAddr[:]) + resolver, err := virtresolver.NewVirtContractResolverFilterer(channelAddrBundle.VirtResolverAddr, conclient) if err != nil { - t.Error(err) - return + return fmt.Errorf("NewVirtContractResolverFilterer: %w", err) } - defer c1.Kill() - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-2"), - "2", - initialBalance) + iter, err := resolver.FilterDeploy(&bind.FilterOpts{}, [][32]byte{virt32}) if err != nil { - t.Error(err) - return + return fmt.Errorf("FilterDeploy: %w", err) } - err = c2.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "2"), - "0", - tf.AddAmtStr(initialBalance, "-2")) - if err != nil { - t.Error(err) - return + defer iter.Close() + deployCount := 0 + for iter.Next() { + deployCount++ } - - err = c1.ConfirmOnChainResolvedPays(tokenType, tokenAddr) - if err != nil { - t.Error(err) - return + if iter.Error() != nil { + return fmt.Errorf("Deploy event iteration: %w", iter.Error()) } - sleep(1) - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-2"), - "0", - tf.AddAmtStr(initialBalance, "2")) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "2"), - "0", - tf.AddAmtStr(initialBalance, "-2")) - if err != nil { - t.Error(err) - return + if deployCount != 1 { + return fmt.Errorf("VirtContractResolver Deploy events for virtAddr = %d, want exactly 1 (mutex should serialize concurrent deploys to a single tx)", deployCount) } + log.Infof("parallel-deploy scenario passed: %d concurrent calls converged on a single deploy tx (Deploy event count = %d)", workers, deployCount) + return nil } -func disputePayWithDeployedGomoku(t *testing.T, tokenType entity.TokenType, tokenAddr string) { +// setupTwoClientChannels creates funded c1 / c2 clients, opens a channel for +// each against the OSP, and returns a cleanup func that kills both clients. +func setupTwoClientChannels(tokenType entity.TokenType, tokenAddr string) ( + *tf.ClientController, *tf.ClientController, string, string, func(), error, +) { ks, addrs, err := tf.CreateAccountsWithBalance(2, accountBalance) if err != nil { - t.Error(err) - return + return nil, nil, "", "", nil, fmt.Errorf("CreateAccountsWithBalance: %w", err) } - log.Infoln("create accounts for disputePayWithDeployedGomoku token", tokenAddr, addrs) if tokenAddr != tokenAddrEth { - err = tf.FundAccountsWithErc20(tokenAddr, addrs, accountBalance) - if err != nil { - t.Error(err) - return - } - } - c1KeyStore := ks[0] - c2KeyStore := ks[1] - c1EthAddr := addrs[0] - c2EthAddr := addrs[1] - if bytes.Compare(ctype.Hex2Bytes(addrs[0]), ctype.Hex2Bytes(addrs[1])) == 1 { - c1KeyStore = ks[1] - c2KeyStore = ks[0] - c1EthAddr = addrs[1] - c2EthAddr = addrs[0] - } - - c1, err := tf.StartC1WithoutProxy(c1KeyStore) - if err != nil { - t.Error(err) - return - } - defer c1.Kill() - - c2, err := tf.StartC2WithoutProxy(c2KeyStore) - if err != nil { - t.Error(err) - return - } - defer c2.Kill() - - _, err = c1.OpenChannel(c1EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return - } - _, err = c2.OpenChannel(c2EthAddr, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - t.Error(err) - return - } - - err = c1.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - t.Error(err) - return - } - - players := []string{c1EthAddr, c2EthAddr} - appChanID, err := c1.NewAppChannelOnDeployedContract( - testapp.GomokuAddr, - testapp.Nonce.Uint64(), - players, - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } - - appChanID2, err := c2.NewAppChannelOnDeployedContract( - testapp.GomokuAddr, - testapp.Nonce.Uint64(), - players, - testapp.Timeout.Uint64()) - if err != nil { - t.Error(err) - return - } - if appChanID != appChanID2 { - err = fmt.Errorf("appChanID does not match") - if err != nil { - t.Error(err) - return - } - } - - sessionQuery := &app.SessionQuery{ - Session: ctype.Hex2Bytes(appChanID), - Query: []byte{2}, - } - serializedSessionQuery, err := proto.Marshal(sessionQuery) - c1Cond := &entity.Condition{ - ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, - DeployedContractAddress: ctype.Hex2Bytes(testapp.GomokuAddr), - ArgsQueryFinalization: ctype.Hex2Bytes(appChanID), - ArgsQueryOutcome: serializedSessionQuery, - } - currentTime, err := c1.GetCurrentBlockNumber() - if err != nil { - t.Error(err) - return - } - payID, err := c1.SendPaymentWithBooleanConditions( - c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{c1Cond}, currentTime+100) - if err != nil { - t.Error(err) - return - } - sleep(1) - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "1", - initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - initialBalance, - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { - t.Error(err) - return - } - sleep(1) - - log.Info("============ Test generic channel onchain API =============") - appState := testapp.GetGomokuState() - c1Sig, _ := c1.SignData(appState) - c2Sig, _ := c2.SignData(appState) - stateProof := &app.StateProof{AppState: appState} - stateProof.Sigs = append(stateProof.Sigs, c1Sig) - stateProof.Sigs = append(stateProof.Sigs, c2Sig) - serializedStateProof, err := proto.Marshal(stateProof) - if err != nil { - t.Error(err) - return - } - - done := make(chan bool) - go tf.AdvanceBlocksUntilDone(done) - - err = c2.SettleAppChannel(appChanID, serializedStateProof) - if err != nil { - t.Error(err) - return - } - - state, err := c2.GetAppChannelState(appChanID, 2) - if err != nil { - t.Error(err) - return - } - if !bytes.Equal(state, testapp.GetGetGomokuBoardState()) { - err = fmt.Errorf("incorrect state %x", state) - if err != nil { - t.Error(err) - return + if err := tf.FundAccountsWithErc20(tokenAddr, addrs, accountBalance); err != nil { + return nil, nil, "", "", nil, fmt.Errorf("FundAccountsWithErc20: %w", err) } } - finalizedTime, err := c2.GetAppChannelSettleFinalizedTime(appChanID) - if err != nil { - t.Error(err) - return - } - - err = c2.WaitUntilDeadline(finalizedTime) - if err != nil { - t.Error(err) - return - } - - err = c2.ApplyAppChannelAction(appChanID, []byte{5, 5}) - if err != nil { - t.Error(err) - return - } - - actionDeadline, err := c2.GetAppChannelActionDeadline(appChanID) - if err != nil { - t.Error(err) - return - } - - err = c2.WaitUntilDeadline(actionDeadline) - if err != nil { - t.Error(err) - return - } - - err = c2.FinalizeAppChannelOnActionTimeout(appChanID) + c1, err := tf.StartC1WithoutProxy(ks[0]) if err != nil { - t.Error(err) - return + return nil, nil, "", "", nil, fmt.Errorf("StartC1: %w", err) } - - finalized, result, err := c2.GetAppChannelBooleanOutcome(appChanID, []byte{2}) + c2, err := tf.StartC2WithoutProxy(ks[1]) if err != nil { - t.Error(err) - return - } - if !finalized { - err = fmt.Errorf("condition not finalized") - if err != nil { - t.Error(err) - return - } + c1.Kill() + return nil, nil, "", "", nil, fmt.Errorf("StartC2: %w", err) } - if !result { - err = fmt.Errorf("result not satisfied") - if err != nil { - t.Error(err) - return - } + cleanup := func() { + c1.Kill() + c2.Kill() } - sleep(1) - amount, _, err := c2.SettleConditionalPayOnChain(payID) - if err != nil { - t.Error(err) - return + if _, err := c1.OpenChannel(addrs[0], tokenType, tokenAddr, initialBalance, initialBalance); err != nil { + cleanup() + return nil, nil, "", "", nil, fmt.Errorf("c1 OpenChannel: %w", err) } - if amount != "1" { - err = fmt.Errorf("pay result not match. expect 1 got %s", amount) - if err != nil { - t.Error(err) - return - } + if _, err := c2.OpenChannel(addrs[1], tokenType, tokenAddr, initialBalance, initialBalance); err != nil { + cleanup() + return nil, nil, "", "", nil, fmt.Errorf("c2 OpenChannel: %w", err) } - - err = c2.SettleOnChainResolvedPay(payID) - if err != nil { - t.Error(err) - return + if err := c1.AssertBalance(tokenAddr, initialBalance, "0", initialBalance); err != nil { + cleanup() + return nil, nil, "", "", nil, fmt.Errorf("c1 AssertBalance: %w", err) } - sleep(1) - done <- true - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "0", - tf.AddAmtStr(initialBalance, "1")) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "1"), - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { - t.Error(err) - return + if err := c2.AssertBalance(tokenAddr, initialBalance, "0", initialBalance); err != nil { + cleanup() + return nil, nil, "", "", nil, fmt.Errorf("c2 AssertBalance: %w", err) } + return c1, c2, addrs[0], addrs[1], cleanup, nil } diff --git a/test/e2e/pay_dispute_with_oracle.go b/test/e2e/pay_dispute_with_oracle.go deleted file mode 100644 index bb3c2f8..0000000 --- a/test/e2e/pay_dispute_with_oracle.go +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright 2018-2025 Celer Network - -package e2e - -import ( - "encoding/hex" - "fmt" - "io/ioutil" - "math/big" - "testing" - - "github.com/celer-network/agent-pay/app" - "github.com/celer-network/agent-pay/ctype" - "github.com/celer-network/agent-pay/entity" - tf "github.com/celer-network/agent-pay/testing" - "github.com/celer-network/agent-pay/testing/testapp" - "github.com/celer-network/goutils/eth" - "github.com/celer-network/goutils/log" - "github.com/ethereum/go-ethereum/accounts/keystore" - "github.com/ethereum/go-ethereum/crypto" - "google.golang.org/protobuf/proto" - "google.golang.org/protobuf/protoadapt" -) - -const oracleKeyStore = "../../testing/env/keystore/etherbase.json" - -func disputeEthPayBySigTimeoutWithDeployedContract(t *testing.T) { - log.Info("============== start test disputeEthPayBySigTimeoutWithDeployedContract ==============") - defer log.Info("============== end test disputeEthPayBySigTimeoutWithDeployedContract ==============") - t.Parallel() - disputePayBySigTimeoutWithDeployedContract(t, entity.TokenType_ETH, tokenAddrEth) -} - -func disputePayBySigTimeoutWithDeployedContract(t *testing.T, tokenType entity.TokenType, tokenAddr string) { - ks, addrs, err := tf.CreateAccountsWithBalance(2, accountBalance) - if err != nil { - t.Error(err) - return - } - log.Infoln("create accounts for disputePayBySigTimeoutWithDeployedContract token", tokenAddr, addrs) - - if tokenAddr != tokenAddrEth { - err = tf.FundAccountsWithErc20(tokenAddr, addrs, accountBalance) - if err != nil { - t.Error(err) - return - } - } - - c1, err := tf.StartC1WithoutProxy(ks[0]) - if err != nil { - t.Error(err) - return - } - defer c1.Kill() - - c2, err := tf.StartC2WithoutProxy(ks[1]) - if err != nil { - t.Error(err) - return - } - defer c2.Kill() - - players := []string{addrs[0], addrs[1]} - appChanID, err := openChannel(c1, players[0], tokenType, tokenAddr, players) - if err != nil { - t.Error(err) - return - } - appChanID1, err := openChannel(c2, players[1], tokenType, tokenAddr, players) - if err != nil { - t.Error(err) - return - } - if appChanID != appChanID1 { - err = fmt.Errorf("appChanID does not match") - if err != nil { - t.Error(err) - return - } - } - - payID, err := sendPayment(c1, appChanID, tokenType, tokenAddr, players[1]) - if err != nil { - t.Error(err) - return - } - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "1", - initialBalance) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - initialBalance, - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { - t.Error(err) - return - } - sleep(1) - - log.Info("============ Test generic channel onchain API =============") - state := 2 - appState := testapp.GetAppStateWithOracle(1, uint8(state), testapp.Nonce.Uint64()) - c1Sig, _ := c1.SignData(appState) - stateProof := &app.StateProof{AppState: appState} - stateProof.Sigs = append(stateProof.Sigs, c1Sig) - serializedStateProof, err := proto.Marshal(stateProof) - if err != nil { - t.Error(err) - return - } - serializedOracleProof, err := getOracleProofBytes(serializedStateProof, players, players[0]) - if err != nil { - t.Error(err) - return - } - - done := make(chan bool) - go tf.AdvanceBlocksUntilDone(done) - - err = c1.SettleAppChannelBySigTimeout(appChanID, serializedOracleProof) - if err != nil { - t.Error(err) - return - } - - err = checkSessionState(c1, appChanID, state) - if err != nil { - t.Error(err) - return - } - - err = settlePay(c2, payID) - if err != nil { - t.Error(err) - return - } - done <- true - - err = c1.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "-1"), - "0", - tf.AddAmtStr(initialBalance, "1")) - if err != nil { - t.Error(err) - return - } - err = c2.AssertBalance( - tokenAddr, - tf.AddAmtStr(initialBalance, "1"), - "0", - tf.AddAmtStr(initialBalance, "-1")) - if err != nil { - t.Error(err) - return - } -} - -func openChannel(client *tf.ClientController, address string, tokenType entity.TokenType, tokenAddr string, players []string) (string, error) { - _, err := client.OpenChannel(address, tokenType, tokenAddr, initialBalance, initialBalance) - if err != nil { - return "", err - } - - err = client.AssertBalance(tokenAddr, initialBalance, "0", initialBalance) - if err != nil { - return "", err - } - - appChanID, err := client.NewAppChannelOnDeployedContract( - testapp.ContractWithOracleAddr, - testapp.Nonce.Uint64(), - players, - testapp.Timeout.Uint64()) - - if err != nil { - return "", err - } - - return appChanID, nil -} - -func sendPayment(client *tf.ClientController, appChanID string, tokenType entity.TokenType, tokenAddr string, peerAddress string) (string, error) { - sessionQuery := &app.SessionQuery{ - Session: ctype.Hex2Bytes(appChanID), - Query: []byte{2}, - } - serializedSessionQuery, err := proto.Marshal(sessionQuery) - c1Cond := &entity.Condition{ - ConditionType: entity.ConditionType_DEPLOYED_CONTRACT, - DeployedContractAddress: ctype.Hex2Bytes(testapp.ContractWithOracleAddr), - ArgsQueryFinalization: ctype.Hex2Bytes(appChanID), - ArgsQueryOutcome: serializedSessionQuery, - } - - currentTime, err := client.GetCurrentBlockNumber() - if err != nil { - return "", err - } - - payID, err := client.SendPaymentWithBooleanConditions( - peerAddress, sendAmt, tokenType, tokenAddr, []*entity.Condition{c1Cond}, currentTime+100) - if err != nil { - return "", err - } - sleep(1) - - return payID, nil -} - -func getOracleProofBytes(stateProofBytes []byte, players []string, updater string) ([]byte, error) { - oracleState := &app.OracleState{ - StateProof: stateProofBytes, - Updater: ctype.Hex2Addr(updater).Bytes(), - UpdateTime: 1, - CurrentTime: 4, - Players: getSortedPlayers(players), - } - serializedOracleState, err := proto.Marshal(protoadapt.MessageV2Of(oracleState)) - if err != nil { - return nil, err - } - - oracleKsBytes, _ := ioutil.ReadFile(oracleKeyStore) - key, _ := keystore.DecryptKey(oracleKsBytes, "") - privKey := hex.EncodeToString(crypto.FromECDSA(key.PrivateKey)) - oracle, err := eth.NewSigner(privKey, nil) - if err != nil { - return nil, err - } - oracleSig, _ := oracle.SignEthMessage(serializedOracleState) - oracleSig = ctype.ToOnChainSig(oracleSig) - oracleProof := &app.OracleProof{ - OracleState: serializedOracleState, - Sig: oracleSig, - } - serializedOracleProof, err := proto.Marshal(protoadapt.MessageV2Of(oracleProof)) - if err != nil { - return nil, err - } - - return serializedOracleProof, err -} - -func checkSessionState(client *tf.ClientController, appChanID string, expectedState int) error { - state, err := client.GetAppChannelState(appChanID, 0) - if err != nil { - return err - } - if state == nil || big.NewInt(0).SetBytes(state).Cmp(big.NewInt(int64(expectedState))) != 0 { - err = fmt.Errorf("incorrect state %x", state) - if err != nil { - return err - } - } - finalized, result, err := client.GetAppChannelBooleanOutcome(appChanID, []byte{byte(expectedState)}) - if err != nil { - return err - } - if !finalized { - err = fmt.Errorf("condition not finalized") - if err != nil { - return err - } - } - if !result { - err = fmt.Errorf("result not satisfied") - if err != nil { - return err - } - } - sleep(1) - - return nil -} - -func settlePay(client *tf.ClientController, payID string) error { - amount, _, err := client.SettleConditionalPayOnChain(payID) - if err != nil { - return err - } - if amount != "1" { - err = fmt.Errorf("pay result not match. expect 1 got %s", amount) - if err != nil { - return err - } - } - err = client.SettleOnChainResolvedPay(payID) - if err != nil { - return err - } - sleep(1) - - return nil -} - -func getSortedPlayers(players []string) [][]byte { - sortedPlayers := app.SortPlayers([]ctype.Addr{ - ctype.Hex2Addr(players[0]), - ctype.Hex2Addr(players[1]), - }) - - return [][]byte{ - sortedPlayers[0].Bytes(), - sortedPlayers[1].Bytes(), - } -} diff --git a/test/e2e/send_pay_settle.go b/test/e2e/send_pay_settle.go index de946bd..4e12fd4 100644 --- a/test/e2e/send_pay_settle.go +++ b/test/e2e/send_pay_settle.go @@ -10,7 +10,6 @@ import ( tf "github.com/celer-network/agent-pay/testing" ta "github.com/celer-network/agent-pay/testing/testapp" "github.com/celer-network/goutils/log" - ec "github.com/ethereum/go-ethereum/common" ) func sendPaySettleWithEthDstReconnect(t *testing.T) { @@ -79,18 +78,10 @@ func sendPaySettleDstReconnect(t *testing.T, tokenType entity.TokenType, tokenAd return } - // construct payment condition - constructor := ta.GetSingleSessionConstructor( - []ec.Address{ - ctype.Hex2Addr(c1Addr), - ctype.Hex2Addr(c2Addr), - }, - ) appChanId, err := c1.NewAppChannelOnVirtualContract( - ta.AppCode, - constructor, - ta.Nonce.Uint64(), - ta.Timeout.Uint64(), + ctype.Hex2Bytes(ta.BooleanCondMockBin), + []byte{}, + 1003, ) if err != nil { t.Error(err) diff --git a/test/e2e/send_pay_timeout.go b/test/e2e/send_pay_timeout.go index c1ba7bf..9001734 100644 --- a/test/e2e/send_pay_timeout.go +++ b/test/e2e/send_pay_timeout.go @@ -4,6 +4,7 @@ package e2e import ( "testing" + "time" "github.com/celer-network/agent-pay/ctype" "github.com/celer-network/agent-pay/entity" @@ -74,16 +75,10 @@ func sendPayTimeout(t *testing.T, tokenType entity.TokenType, tokenAddr string) return } - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ - ctype.Hex2Addr(c1EthAddr), - ctype.Hex2Addr(c2EthAddr), - }) appChanID, err := c1.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) + ctype.Hex2Bytes(testapp.BooleanCondMockBin), + []byte{}, + 1002) if err != nil { t.Error(err) return @@ -108,8 +103,9 @@ func sendPayTimeout(t *testing.T, tokenType entity.TokenType, tokenAddr string) ArgsQueryOutcome: []byte{2}, } - // source pay in full - timeout := uint64(3) + // source pay in full. Pay-resolve timeout in seconds, kept short so the + // timeout-and-sweep flow runs fast in CI. + timeout := uint64(5) _, err = c1.SendPaymentWithBooleanConditions( c2EthAddr, sendAmt, tokenType, tokenAddr, []*entity.Condition{c1Cond1}, timeout) if err != nil { @@ -128,11 +124,8 @@ func sendPayTimeout(t *testing.T, tokenType entity.TokenType, tokenAddr string) t.Error(err) return } - payTime, err := c1.GetCurrentBlockNumber() - if err != nil { - t.Error(err) - return - } + // Pay deadline is unix timestamp (seconds) now; capture wall clock as the reference. + payTime := uint64(time.Now().Unix()) err = waitForPaymentPending(p3, c2, c1) if err != nil { @@ -159,6 +152,8 @@ func sendPayTimeout(t *testing.T, tokenType entity.TokenType, tokenAddr string) return } + // Wait past the pay deadline + receiver-side safe margin (CELER_PAY_RECV_SAFE_MARGIN_S=5 + // in TestMain) so SettleExpiredPays sees the pay as expired. err = c1.WaitUntilDeadline(payTime + timeout + 10) if err != nil { t.Error(err) diff --git a/test/e2e/send_pay_with_app.go b/test/e2e/send_pay_with_app.go index 975f4a0..ec1f8ec 100644 --- a/test/e2e/send_pay_with_app.go +++ b/test/e2e/send_pay_with_app.go @@ -74,16 +74,10 @@ func sendPayOnVirtualContractCondition(t *testing.T, tokenType entity.TokenType, return } - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ - ctype.Hex2Addr(c1EthAddr), - ctype.Hex2Addr(c2EthAddr), - }) appChanID, err := c1.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) + ctype.Hex2Bytes(testapp.BooleanCondMockBin), + []byte{}, + 1008) if err != nil { t.Error(err) return diff --git a/test/e2e/setup_onchain.go b/test/e2e/setup_onchain.go index 2666777..cd06d9e 100644 --- a/test/e2e/setup_onchain.go +++ b/test/e2e/setup_onchain.go @@ -108,43 +108,18 @@ func SetupOnChain(appMap map[string]ctype.Addr, groupId uint64, autofund bool) ( } chkTxStatus(receipt.Status, "Deploy ERC20 "+ctype.Addr2Hex(erc20Addr)) - // Deploy MultiSessionApp contract - appAddr1, tx3, _, err := testapp.DeploySimpleMultiSessionApp(etherBaseAuth, conclient, testapp.PlayerNum) + // Deploy BooleanCondMock — the on-chain IBooleanCond used by both + // VIRTUAL_CONTRACT and DEPLOYED_CONTRACT dispute scenarios. + appAddr1, tx3, _, err := testapp.DeployBooleanCondMock(etherBaseAuth, conclient) if err != nil { - log.Fatalf("Failed to deploy SimpleMultiSessionApp contract: %v", err) + log.Fatalf("Failed to deploy BooleanCondMock contract: %v", err) } receipt, err = eth.WaitMined(ctx, conclient, tx3, eth.WithPollingInterval(time.Second)) if err != nil { log.Fatal(err) } - chkTxStatus(receipt.Status, "Deploy SimpleMultiSessionApp "+ctype.Addr2Hex(appAddr1)) - appMap["SimpleMultiSessionApp"] = appAddr1 - - // Deploy MultiSessionAppWithOracle contract - timeout := new(big.Int).SetUint64(2) - appAddr2, tx4, _, err := testapp.DeploySimpleMultiSessionAppWithOracle( - etherBaseAuth, conclient, timeout, timeout, testapp.PlayerNum, ctype.Hex2Addr(etherBaseAddr)) - if err != nil { - log.Fatalf("Failed to deploy SimpleMultiSessionAppWithOracle contract: %v", err) - } - appMap["SimpleMultiSessionAppWithOracle"] = appAddr2 - receipt, err = eth.WaitMined(ctx, conclient, tx4, eth.WithPollingInterval(time.Second)) - if err != nil { - log.Fatal(err) - } - chkTxStatus(receipt.Status, "Deploy SimpleMultiSessionAppWithOracle "+ctype.Addr2Hex(appAddr2)) - - // Deploy MultiGomoku contract - appAddr3, tx5, _, err := testapp.DeployMultiGomoku(etherBaseAuth, conclient, testapp.GomokuMinOffChain, testapp.GomokuMaxOnChain) - if err != nil { - log.Fatalf("Failed to deploy MultiGomoku contract: %v", err) - } - appMap["MultiGomoku"] = appAddr3 - receipt, err = eth.WaitMined(ctx, conclient, tx5, eth.WithPollingInterval(time.Second)) - if err != nil { - log.Fatal(err) - } - chkTxStatus(receipt.Status, "Deploy MultiGomoku "+ctype.Addr2Hex(appAddr3)) + chkTxStatus(receipt.Status, "Deploy BooleanCondMock "+ctype.Addr2Hex(appAddr1)) + appMap["BooleanCondMock"] = appAddr1 // Deploy a new Celer Ledger for channel migration test log.Infoln("Deploying new CelerLedger contract...") diff --git a/test/e2e/sliding_window.go b/test/e2e/sliding_window.go index 1963395..ee09280 100644 --- a/test/e2e/sliding_window.go +++ b/test/e2e/sliding_window.go @@ -74,17 +74,12 @@ func slidingWindow(t *testing.T, tokenType entity.TokenType, tokenAddr string) { return } - // construct payment condition - constructor := testapp.GetSingleSessionConstructor( - []ctype.Addr{ - ctype.Hex2Addr(c1EthAddr), - ctype.Hex2Addr(c2EthAddr), - }) + // register a virtual condition contract; the bytecode is just a vehicle + // for a deterministic virtual address, the contract is never queried. appChanID, err := c1.NewAppChannelOnVirtualContract( - testapp.AppCode, - constructor, - testapp.Nonce.Uint64(), - testapp.Timeout.Uint64()) + ctype.Hex2Bytes(testapp.BooleanCondMockBin), + []byte{}, + 1001) if err != nil { t.Error(err) return diff --git a/test/manual/rt_config.json b/test/manual/rt_config.json index e87bd41..41fd339 100644 --- a/test/manual/rt_config.json +++ b/test/manual/rt_config.json @@ -9,13 +9,13 @@ "min_deposit": "1000000000000", "max_deposit": "100000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500 + "max_deadline_delta": 7200 }, "0000000000000000000000000000000000000000": { "min_deposit": "1000000000000", "max_deposit": "100000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 7200, "matching_ratio": 1.0 } } diff --git a/testing/clientcontroller.go b/testing/clientcontroller.go index df41c6b..ea7577c 100644 --- a/testing/clientcontroller.go +++ b/testing/clientcontroller.go @@ -396,7 +396,7 @@ func (cc *ClientController) GetPayHistory(fromStart bool, itemsPerPage int32) ([ func (cc *ClientController) GetSettleFinalizedTime( tokenType entity.TokenType, tokenAddr string) (uint64, error) { - blknum, err := cc.apiClient.GetSettleFinalizedTimeForPaymentChannel( + resp, err := cc.apiClient.GetSettleFinalizedTimeForPaymentChannel( context.Background(), &rpc.TokenInfo{ TokenType: tokenType, @@ -405,7 +405,7 @@ func (cc *ClientController) GetSettleFinalizedTime( if err != nil { return 0, err } - return blknum.BlockNumber, nil + return resp.Timestamp, nil } func (cc *ClientController) OpenChannel( @@ -679,13 +679,6 @@ func (cc *ClientController) SettleConditionalPayOnChain(paymentID string) (strin return info.Amount, info.ResolveDeadline, nil } -func (cc *ClientController) SignOutgoingState(sessionID string, state []byte) ([]byte, error) { - signedState, err := cc.apiClient.SignOutgoingState( - context.Background(), - &rpc.SignOutgoingStateRequest{SessionId: sessionID, State: state}) - return signedState.SignedState, err -} - func (cc *ClientController) SignData(data []byte) ([]byte, error) { signature, err := cc.apiClient.SignData(context.Background(), &rpc.Data{Data: data}) if err != nil { @@ -705,30 +698,13 @@ func (cc *ClientController) SyncOnChainChannelStates(tokenType entity.TokenType, } func (cc *ClientController) NewAppChannelOnVirtualContract( - byteCode []byte, constructor []byte, nonce uint64, timeout uint64) (string, error) { + byteCode []byte, constructor []byte, nonce uint64) (string, error) { sessionID, err := cc.apiClient.CreateAppSessionOnVirtualContract( context.Background(), &rpc.CreateAppSessionOnVirtualContractRequest{ ContractBin: ctype.Bytes2Hex(byteCode), ContractConstructor: ctype.Bytes2Hex(constructor), Nonce: nonce, - OnChainTimeout: timeout, - }) - if err != nil { - return "", err - } - return sessionID.SessionId, nil -} - -func (cc *ClientController) NewAppChannelOnDeployedContract( - contractAddress string, nonce uint64, participants []string, timeout uint64) (string, error) { - sessionID, err := cc.apiClient.CreateAppSessionOnDeployedContract( - context.Background(), - &rpc.CreateAppSessionOnDeployedContractRequest{ - ContractAddress: contractAddress, - Nonce: nonce, - Participants: participants, - OnChainTimeout: timeout, }) if err != nil { return "", err @@ -736,57 +712,6 @@ func (cc *ClientController) NewAppChannelOnDeployedContract( return sessionID.SessionId, nil } -func (cc *ClientController) SettleAppChannel(cid string, stateproof []byte) error { - _, err := cc.apiClient.SettleAppSession( - context.Background(), - &rpc.SettleAppSessionRequest{ - SessionId: cid, - StateProof: stateproof, - }) - return err -} - -func (cc *ClientController) SettleAppChannelBySigTimeout(cid string, oracleProof []byte) error { - _, err := cc.apiClient.SettleAppSessionBySigTimeout( - context.Background(), - &rpc.SettleAppSessionByTimeoutRequest{ - SessionId: cid, - OracleProof: oracleProof, - }) - return err -} - -func (cc *ClientController) SettleAppChannelByMoveTimeout(cid string, oracleProof []byte) error { - _, err := cc.apiClient.SettleAppSessionByMoveTimeout( - context.Background(), - &rpc.SettleAppSessionByTimeoutRequest{ - SessionId: cid, - OracleProof: oracleProof, - }) - return err -} - -func (cc *ClientController) SettleAppChannelByInvalidTurn(cid string, oracleProof []byte, cosignedStateProof []byte) error { - _, err := cc.apiClient.SettleAppSessionByInvalidTurn( - context.Background(), - &rpc.SettleAppSessionByInvalidityRequest{ - SessionId: cid, - OracleProof: oracleProof, - CosignedStateProof: cosignedStateProof, - }) - return err -} - -func (cc *ClientController) SettleAppChannelByInvalidState(cid string, oracleProof []byte, cosignedStateProof []byte) error { - _, err := cc.apiClient.SettleAppSessionByInvalidState( - context.Background(), - &rpc.SettleAppSessionByInvalidityRequest{ - SessionId: cid, - OracleProof: oracleProof, - CosignedStateProof: cosignedStateProof, - }) - return err -} func (cc *ClientController) DeleteAppChannel(cid string) error { _, err := cc.apiClient.DeleteAppSession( @@ -797,19 +722,6 @@ func (cc *ClientController) DeleteAppChannel(cid string) error { return err } -func (cc *ClientController) GetAppChannelState(cid string, key int64) ([]byte, error) { - resp, err := cc.apiClient.GetStateForAppSession( - context.Background(), - &rpc.GetStateForAppSessionRequest{ - SessionId: cid, - Key: key, - }) - if err != nil { - return nil, err - } - return resp.State, err -} - func (cc *ClientController) GetAppChannelBooleanOutcome( cid string, query []byte) (bool, bool, error) { resp, err := cc.apiClient.GetBooleanOutcomeForAppSession( @@ -824,64 +736,25 @@ func (cc *ClientController) GetAppChannelBooleanOutcome( return resp.Finalized, resp.Outcome, err } -func (cc *ClientController) GetAppChannelSettleFinalizedTime(cid string) (uint64, error) { - blkNum, err := cc.apiClient.GetSettleFinalizedTimeForAppSession( - context.Background(), - &rpc.SessionID{ - SessionId: cid, - }) - if err != nil { - return 0, err - } - return blkNum.BlockNumber, err -} - -func (cc *ClientController) ApplyAppChannelAction(cid string, action []byte) error { - _, err := cc.apiClient.ApplyActionForAppSession( - context.Background(), - &rpc.ApplyActionForAppSessionRequest{ - SessionId: cid, - Action: action, - }) - return err -} - -func (cc *ClientController) GetAppChannelActionDeadline(cid string) (uint64, error) { - blkNum, err := cc.apiClient.GetActionDeadlineForAppSession( - context.Background(), - &rpc.SessionID{ - SessionId: cid, - }) - if err != nil { - return 0, err - } - return blkNum.BlockNumber, nil -} - -func (cc *ClientController) FinalizeAppChannelOnActionTimeout(cid string) error { - _, err := cc.apiClient.FinalizeOnActionTimeoutForAppSession( - context.Background(), - &rpc.SessionID{ - SessionId: cid, - }) - return err -} - +// WaitUntilDeadline blocks until wall-clock unix time has passed the given deadline. +// Use this for agent-pay channel/payment deadlines, which are unix timestamps (seconds) +// matching the contract's `block.timestamp`-based windows. On local geth `--dev` chains +// where block.timestamp only advances on new blocks, this also nudges the chain so +// subsequent on-chain assertions see the new time. func (cc *ClientController) WaitUntilDeadline(deadline uint64) error { - log.Infoln("Wait until deadline", deadline) + log.Infoln("Wait until deadline (unix ts)", deadline) for { - current, err := cc.GetCurrentBlockNumber() - if err != nil { - return err - } - log.Infoln("-- current block number --", current) - if current > deadline { + nowTs := uint64(time.Now().Unix()) + log.Infoln("-- current unix ts --", nowTs) + if nowTs > deadline { return nil } - err = AdvanceBlocks(1) - if err != nil { + // Advance the local chain so block.timestamp tracks wall clock for any + // subsequent on-chain assertions, then poll once per second. + if err := AdvanceBlocks(1); err != nil { return err } + time.Sleep(time.Second) } } diff --git a/testing/profile/rt_config_multiosp.json b/testing/profile/rt_config_multiosp.json index 3a024ed..690ac28 100644 --- a/testing/profile/rt_config_multiosp.json +++ b/testing/profile/rt_config_multiosp.json @@ -10,7 +10,7 @@ "min_deposit": "0", "max_deposit": "10000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 1200, "matching_ratio": 1.0 } } @@ -21,7 +21,7 @@ "min_deposit": "0", "max_deposit": "10000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 1200, "matching_ratio": 1.0 } } @@ -32,7 +32,7 @@ "min_deposit": "0", "max_deposit": "10000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 1200, "matching_ratio": 1.0 } } @@ -43,7 +43,7 @@ "min_deposit": "0", "max_deposit": "10000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 1200, "matching_ratio": 1.0 } } @@ -54,7 +54,7 @@ "min_deposit": "0", "max_deposit": "10000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 1200, "matching_ratio": 1.0 } } @@ -67,13 +67,13 @@ "min_deposit": "0", "max_deposit": "1", "min_deadline_delta": 1, - "max_deadline_delta": 500 + "max_deadline_delta": 1200 }, "0000000000000000000000000000000000000000": { "min_deposit": "0", "max_deposit": "5000000000000000000", "min_deadline_delta": 1, - "max_deadline_delta": 500, + "max_deadline_delta": 1200, "matching_ratio": 1.0 } } diff --git a/testing/testapp/booleancondmock.go b/testing/testapp/booleancondmock.go new file mode 100644 index 0000000..264f83c --- /dev/null +++ b/testing/testapp/booleancondmock.go @@ -0,0 +1,266 @@ +// Regenerated by tools/scripts/regenerate-go-bindings.sh — DO NOT EDIT. +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package testapp + +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" +) + +// 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 +) + +// BooleanCondMockMetaData contains all meta data concerning the BooleanCondMock contract. +var BooleanCondMockMetaData = &bind.MetaData{ + ABI: "[{\"type\":\"function\",\"name\":\"getOutcome\",\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"isFinalized\",\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"pure\"}]", + Bin: "0x6080604052348015600e575f5ffd5b506102228061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610034575f3560e01c8063bcdbda9414610038578063ea4ba8eb1461005f575b5f5ffd5b61004b610046366004610140565b610072565b604051901515815260200160405180910390f35b61004b61006d366004610140565b6100c9565b5f818103610082575060016100c3565b6100c083838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061010892505050565b90505b92915050565b5f6100c083838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061010892505050565b5f81515f0361011857505f919050565b6020828101518351909161012c91906101c2565b6101379060086101d5565b1c151592915050565b5f5f60208385031215610151575f5ffd5b823567ffffffffffffffff811115610167575f5ffd5b8301601f81018513610177575f5ffd5b803567ffffffffffffffff81111561018d575f5ffd5b85602082840101111561019e575f5ffd5b6020919091019590945092505050565b634e487b7160e01b5f52601160045260245ffd5b818103818111156100c3576100c36101ae565b80820281158282048414176100c3576100c36101ae56fea2646970667358221220c12eebfbdbfdf6caab643570ac750da3584d021123904390dd66e5245cb3823f64736f6c634300081e0033", +} + +// BooleanCondMockABI is the input ABI used to generate the binding from. +// Deprecated: Use BooleanCondMockMetaData.ABI instead. +var BooleanCondMockABI = BooleanCondMockMetaData.ABI + +// BooleanCondMockBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use BooleanCondMockMetaData.Bin instead. +var BooleanCondMockBin = BooleanCondMockMetaData.Bin + +// DeployBooleanCondMock deploys a new Ethereum contract, binding an instance of BooleanCondMock to it. +func DeployBooleanCondMock(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *BooleanCondMock, error) { + parsed, err := BooleanCondMockMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(BooleanCondMockBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &BooleanCondMock{BooleanCondMockCaller: BooleanCondMockCaller{contract: contract}, BooleanCondMockTransactor: BooleanCondMockTransactor{contract: contract}, BooleanCondMockFilterer: BooleanCondMockFilterer{contract: contract}}, nil +} + +// BooleanCondMock is an auto generated Go binding around an Ethereum contract. +type BooleanCondMock struct { + BooleanCondMockCaller // Read-only binding to the contract + BooleanCondMockTransactor // Write-only binding to the contract + BooleanCondMockFilterer // Log filterer for contract events +} + +// BooleanCondMockCaller is an auto generated read-only Go binding around an Ethereum contract. +type BooleanCondMockCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BooleanCondMockTransactor is an auto generated write-only Go binding around an Ethereum contract. +type BooleanCondMockTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BooleanCondMockFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type BooleanCondMockFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// BooleanCondMockSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type BooleanCondMockSession struct { + Contract *BooleanCondMock // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// BooleanCondMockCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type BooleanCondMockCallerSession struct { + Contract *BooleanCondMockCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// BooleanCondMockTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type BooleanCondMockTransactorSession struct { + Contract *BooleanCondMockTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// BooleanCondMockRaw is an auto generated low-level Go binding around an Ethereum contract. +type BooleanCondMockRaw struct { + Contract *BooleanCondMock // Generic contract binding to access the raw methods on +} + +// BooleanCondMockCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type BooleanCondMockCallerRaw struct { + Contract *BooleanCondMockCaller // Generic read-only contract binding to access the raw methods on +} + +// BooleanCondMockTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type BooleanCondMockTransactorRaw struct { + Contract *BooleanCondMockTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewBooleanCondMock creates a new instance of BooleanCondMock, bound to a specific deployed contract. +func NewBooleanCondMock(address common.Address, backend bind.ContractBackend) (*BooleanCondMock, error) { + contract, err := bindBooleanCondMock(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &BooleanCondMock{BooleanCondMockCaller: BooleanCondMockCaller{contract: contract}, BooleanCondMockTransactor: BooleanCondMockTransactor{contract: contract}, BooleanCondMockFilterer: BooleanCondMockFilterer{contract: contract}}, nil +} + +// NewBooleanCondMockCaller creates a new read-only instance of BooleanCondMock, bound to a specific deployed contract. +func NewBooleanCondMockCaller(address common.Address, caller bind.ContractCaller) (*BooleanCondMockCaller, error) { + contract, err := bindBooleanCondMock(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &BooleanCondMockCaller{contract: contract}, nil +} + +// NewBooleanCondMockTransactor creates a new write-only instance of BooleanCondMock, bound to a specific deployed contract. +func NewBooleanCondMockTransactor(address common.Address, transactor bind.ContractTransactor) (*BooleanCondMockTransactor, error) { + contract, err := bindBooleanCondMock(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &BooleanCondMockTransactor{contract: contract}, nil +} + +// NewBooleanCondMockFilterer creates a new log filterer instance of BooleanCondMock, bound to a specific deployed contract. +func NewBooleanCondMockFilterer(address common.Address, filterer bind.ContractFilterer) (*BooleanCondMockFilterer, error) { + contract, err := bindBooleanCondMock(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &BooleanCondMockFilterer{contract: contract}, nil +} + +// bindBooleanCondMock binds a generic wrapper to an already deployed contract. +func bindBooleanCondMock(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := BooleanCondMockMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_BooleanCondMock *BooleanCondMockRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _BooleanCondMock.Contract.BooleanCondMockCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_BooleanCondMock *BooleanCondMockRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BooleanCondMock.Contract.BooleanCondMockTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_BooleanCondMock *BooleanCondMockRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _BooleanCondMock.Contract.BooleanCondMockTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_BooleanCondMock *BooleanCondMockCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _BooleanCondMock.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_BooleanCondMock *BooleanCondMockTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _BooleanCondMock.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_BooleanCondMock *BooleanCondMockTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _BooleanCondMock.Contract.contract.Transact(opts, method, params...) +} + +// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. +// +// Solidity: function getOutcome(bytes _query) pure returns(bool) +func (_BooleanCondMock *BooleanCondMockCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { + var out []interface{} + err := _BooleanCondMock.contract.Call(opts, &out, "getOutcome", _query) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. +// +// Solidity: function getOutcome(bytes _query) pure returns(bool) +func (_BooleanCondMock *BooleanCondMockSession) GetOutcome(_query []byte) (bool, error) { + return _BooleanCondMock.Contract.GetOutcome(&_BooleanCondMock.CallOpts, _query) +} + +// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. +// +// Solidity: function getOutcome(bytes _query) pure returns(bool) +func (_BooleanCondMock *BooleanCondMockCallerSession) GetOutcome(_query []byte) (bool, error) { + return _BooleanCondMock.Contract.GetOutcome(&_BooleanCondMock.CallOpts, _query) +} + +// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. +// +// Solidity: function isFinalized(bytes _query) pure returns(bool) +func (_BooleanCondMock *BooleanCondMockCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { + var out []interface{} + err := _BooleanCondMock.contract.Call(opts, &out, "isFinalized", _query) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. +// +// Solidity: function isFinalized(bytes _query) pure returns(bool) +func (_BooleanCondMock *BooleanCondMockSession) IsFinalized(_query []byte) (bool, error) { + return _BooleanCondMock.Contract.IsFinalized(&_BooleanCondMock.CallOpts, _query) +} + +// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. +// +// Solidity: function isFinalized(bytes _query) pure returns(bool) +func (_BooleanCondMock *BooleanCondMockCallerSession) IsFinalized(_query []byte) (bool, error) { + return _BooleanCondMock.Contract.IsFinalized(&_BooleanCondMock.CallOpts, _query) +} diff --git a/testing/testapp/multigomoku.go b/testing/testapp/multigomoku.go deleted file mode 100644 index 7a0da5a..0000000 --- a/testing/testapp/multigomoku.go +++ /dev/null @@ -1,721 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package testapp - -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" -) - -// 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 -) - -// MultiGomokuMetaData contains all meta data concerning the MultiGomoku contract. -var MultiGomokuMetaData = &bind.MetaData{ - ABI: "[{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getSettleFinalizedTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_stateProof\",\"type\":\"bytes\"}],\"name\":\"intendSettle\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getSeqNum\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_signers\",\"type\":\"address[]\"}],\"name\":\"getSessionID\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"minStoneOffchain\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"finalizeOnActionTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"maxStoneOnchain\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getActionDeadline\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_action\",\"type\":\"bytes\"}],\"name\":\"applyAction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_minStoneOffchain\",\"type\":\"uint8\"},{\"name\":\"_maxStoneOnchain\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"session\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"seq\",\"type\":\"uint256\"}],\"name\":\"IntendSettle\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50604051604080612f318339810180604052604081101561003057600080fd5b810190808051906020019092919080519060200190929190505050600280806000800181905550505081600260006101000a81548160ff021916908360ff16021790555080600260016101000a81548160ff021916908360ff1602179055505050612e91806100a06000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c80637ca221571161008c578063c1a2865611610066578063c1a286561461044c578063cab9244614610470578063ea4ba8eb146104b2578063f3c7719214610543576100cf565b80637ca2215714610369578063b89fa28b1461038d578063bcdbda94146103bb576100cf565b806309b65d86146100d4578063130d33fe1461011657806329dd2f8e1461018f5780633b6de66f146102405780634d8bedec146102825780635de28ae014610319575b600080fd5b610100600480360360208110156100ea57600080fd5b81019080803590602001909291905050506105c6565b6040518082815260200191505060405180910390f35b61018d6004803603602081101561012c57600080fd5b810190808035906020019064010000000081111561014957600080fd5b82018360208201111561015b57600080fd5b8035906020019184600183028401116401000000008311171561017d57600080fd5b9091929391929390505050610632565b005b6101c5600480360360408110156101a557600080fd5b810190808035906020019092919080359060200190929190505050610a39565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102055780820151818401526020810190506101ea565b50505050905090810190601f1680156102325780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61026c6004803603602081101561025657600080fd5b8101908080359060200190929190505050610d07565b6040518082815260200191505060405180910390f35b6103036004803603604081101561029857600080fd5b8101908080359060200190929190803590602001906401000000008111156102bf57600080fd5b8201836020820111156102d157600080fd5b803590602001918460208302840111640100000000831117156102f357600080fd5b9091929391929390505050610d27565b6040518082815260200191505060405180910390f35b6103456004803603602081101561032f57600080fd5b8101908080359060200190929190505050610d90565b6040518082600381111561035557fe5b60ff16815260200191505060405180910390f35b610371610dbd565b604051808260ff1660ff16815260200191505060405180910390f35b6103b9600480360360208110156103a357600080fd5b8101908080359060200190929190505050610dd0565b005b610432600480360360208110156103d157600080fd5b81019080803590602001906401000000008111156103ee57600080fd5b82018360208201111561040057600080fd5b8035906020019184600183028401116401000000008311171561042257600080fd5b9091929391929390505050610e85565b604051808215151515815260200191505060405180910390f35b610454610f1c565b604051808260ff1660ff16815260200191505060405180910390f35b61049c6004803603602081101561048657600080fd5b8101908080359060200190929190505050610f2f565b6040518082815260200191505060405180910390f35b610529600480360360208110156104c857600080fd5b81019080803590602001906401000000008111156104e557600080fd5b8201836020820111156104f757600080fd5b8035906020019184600183028401116401000000008311171561051957600080fd5b9091929391929390505050611013565b604051808215151515815260200191505060405180910390f35b6105c46004803603604081101561055957600080fd5b81019080803590602001909291908035906020019064010000000081111561058057600080fd5b82018360208201111561059257600080fd5b803590602001918460018302840111640100000000831117156105b457600080fd5b9091929391929390505050611087565b005b6000600160038111156105d557fe5b6001600084815260200190815260200160002060040160009054906101000a900460ff16600381111561060457fe5b1415610628576001600083815260200190815260200160002060030154905061062d565b600090505b919050565b61063a612c7a565b61068783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506112be565b9050606061069f826000015183602001516001611435565b9050600080015481511461071b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f696e76616c6964206e756d626572206f6620706c61796572730000000000000081525060200191505060405180910390fd5b610723612c94565b610730836000015161164c565b905060008160000151836040516020018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561078657808201518184015260208101905061076b565b5050505090500193505050506040516020818303038152906040528051906020012090506000600160008381526020019081526020016000209050600060038111156107ce57fe5b8160040160009054906101000a900460ff1660038111156107eb57fe5b141561080b5783816000019080519060200190610809929190612cbc565b505b60038081111561081757fe5b8160040160009054906101000a900460ff16600381111561083457fe5b14156108a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f73746174652069732066696e616c697a6564000000000000000000000000000081525060200191505060405180910390fd5b8260200151816001015410610925576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f696e76616c69642073657175656e6365206e756d62657200000000000000000081525060200191505060405180910390fd5b8260200151816001018190555060018160040160006101000a81548160ff0219169083600381111561095357fe5b02179055508260600151816002018190555082606001514301816003018190555061098282846040015161173a565b6109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f737461746520757064617465206661696c65640000000000000000000000000081525060200191505060405180910390fd5b817f82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b82600101546040518082815260200191505060405180910390a250505050505050565b606060016002811115610a4857fe5b821415610b4557606060016040519080825280601f01601f191660200182016040528015610a855781602001600182028038833980820191505090505b509050600360008581526020019081526020016000206000016000815460018160011615610100020316600290048110610abb57fe5b815460011615610ada5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000281600081518110610b0d57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080915050610d01565b60006002811115610b5257fe5b821415610c4f57606060016040519080825280601f01601f191660200182016040528015610b8f5781602001600182028038833980820191505090505b509050600360008581526020019081526020016000206000016001815460018160011615610100020316600290048110610bc557fe5b815460011615610be45790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000281600081518110610c1757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080915050610d01565b600360008481526020019081526020016000206000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cf95780601f10610cce57610100808354040283529160200191610cf9565b820191906000526020600020905b815481529060010190602001808311610cdc57829003601f168201915b505050505090505b92915050565b600060016000838152602001908152602001600020600101549050919050565b600083838360405160200180848152602001806020018281038252848482818152602001925060200280828437600081840152601f19601f8201169050808301925050509450505050506040516020818303038152906040528051906020012090509392505050565b60006001600083815260200190815260200160002060040160009054906101000a900460ff169050919050565b600260009054906101000a900460ff1681565b600060016000838152602001908152602001600020905060008160040160009054906101000a900460ff16905060008260030154905060026003811115610e1357fe5b826003811115610e1f57fe5b1415610e3657804311610e3157600080fd5b610e75565b60016003811115610e4357fe5b826003811115610e4f57fe5b1415610e6c57826002015481014311610e6757600080fd5b610e74565b505050610e82565b5b610e7e846119ba565b5050505b50565b600080610ed584848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611a08565b9050600380811115610ee357fe5b6001600083815260200190815260200160002060040160009054906101000a900460ff166003811115610f1257fe5b1491505092915050565b600260019054906101000a900460ff1681565b600060026003811115610f3e57fe5b6001600084815260200190815260200160002060040160009054906101000a900460ff166003811115610f6d57fe5b1415610f91576001600083815260200190815260200160002060030154905061100e565b60016003811115610f9e57fe5b6001600084815260200190815260200160002060040160009054906101000a900460ff166003811115610fcd57fe5b1415611009576001600083815260200190815260200160002060020154600160008481526020019081526020016000206003015401905061100e565b600090505b919050565b600061101d612d46565b61106a84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611a24565b905061107e81600001518260200151611ad8565b91505092915050565b60006001600085815260200190815260200160002090506003808111156110aa57fe5b8160040160009054906101000a900460ff1660038111156110c757fe5b141561113b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b6001600381111561114857fe5b8160040160009054906101000a900460ff16600381111561116557fe5b1480156111755750438160030154105b156111a15760028160040160006101000a81548160ff0219169083600381111561119b57fe5b02179055505b600260038111156111ae57fe5b8160040160009054906101000a900460ff1660038111156111cb57fe5b1461123e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f617070206e6f7420696e20616374696f6e206d6f64650000000000000000000081525060200191505060405180910390fd5b80600101600081548092919060010191905055508060020154430181600301819055506112af8484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611c2e565b6112b857600080fd5b50505050565b6112c6612c7a565b6112ce612d63565b6112d78361237e565b905060606112ef6002836123ad90919063ffffffff16565b9050806002815181106112fe57fe5b602002602001015160405190808252806020026020018201604052801561133957816020015b60608152602001906001900390816113245790505b50836020018190525060008160028151811061135157fe5b6020026020010181815250506000805b61136a84612452565b1561142c5761137884612467565b809250819350505060001561138c57611427565b60018214156113ab5761139e8461249b565b8560000181905250611426565b6002821415611411576113bd8461249b565b8560200151846002815181106113cf57fe5b6020026020010151815181106113e157fe5b6020026020010181905250826002815181106113f957fe5b60200260200101805180919060010181525050611425565b611424818561255490919063ffffffff16565b5b5b5b611361565b50505050919050565b60608083516040519080825280602002602001820160405280156114685781602001602082028038833980820191505090505b50905060006114e7866040516020018082805190602001908083835b602083106114a75780518252602082019150602081019050602083039250611484565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206125e4565b9050600080905060008090505b865181101561163e5761151a8388838151811061150d57fe5b602002602001015161263c565b84828151811061152657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508515611631578173ffffffffffffffffffffffffffffffffffffffff1684828151811061158957fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161161161a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f7369676e657273206e6f7420696e20617363656e64696e67206f72646572000081525060200191505060405180910390fd5b83818151811061162657fe5b602002602001015191505b80806001019150506114f4565b508293505050509392505050565b611654612c94565b61165c612d63565b6116658361237e565b90506000805b61167483612452565b156117325761168283612467565b80925081935050506000156116965761172d565b60018214156116b6576116a88361271c565b84600001818152505061172c565b60028214156116d6576116c88361271c565b84602001818152505061172b565b60038214156116f5576116e88361249b565b846040018190525061172a565b6004821415611715576117078361271c565b846060018181525050611729565b611728818461255490919063ffffffff16565b5b5b5b5b5b61166b565b505050919050565b600060e48251146117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207374617465206c656e67746800000000000000000000000081525060200191505060405180910390fd5b600060036000858152602001908152602001600020905060008160000180546001816001161561010002031660029004905014156118395760e46040519080825280601f01601f19166020018201604052801561181f5781602001600182028038833980820191505090505b50816000019080519060200190611837929190612d7d565b505b60008360008151811061184857fe5b602001015160f81c60f81b60f81c60ff161461188757611882848460008151811061186f57fe5b602001015160f81c60f81b60f81c6127a2565b611996565b60008090506000600390505b60e48110156118d65760008582815181106118aa57fe5b602001015160f81c60f81b60f81c60ff16146118c95781806001019250505b8080600101915050611893565b50808260010160006101000a81548161ffff021916908361ffff160217905550600260009054906101000a900460ff1660ff168260010160009054906101000a900461ffff1661ffff161015611994576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f6e6f7420656e6f756768206f66666368616e2073746f6e65730000000000000081525060200191505060405180910390fd5b505b828160000190805190602001906119ae929190612d7d565b50600191505092915050565b600160ff166119c882612889565b60ff1614156119e1576119dc8160026127a2565b611a05565b600260ff166119ef82612889565b60ff161415611a0457611a038160016127a2565b5b5b50565b60006020825114611a1857600080fd5b60208201519050919050565b611a2c612d46565b611a34612d63565b611a3d8361237e565b90506000805b611a4c83612452565b15611ad057611a5a83612467565b8092508193505050600015611a6e57611acb565b6001821415611a9657611a88611a838461249b565b611a08565b846000018181525050611aca565b6002821415611ab557611aa88361249b565b8460200181905250611ac9565b611ac8818461255490919063ffffffff16565b5b5b5b611a43565b505050919050565b60006001825114611b51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207175657279206c656e67746800000000000000000000000081525060200191505060405180910390fd5b81600081518110611b5e57fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916600360008581526020019081526020016000206000016000815460018160011615610100020316600290048110611bbe57fe5b815460011615611bdd5790600052602060002090602091828204019190065b9054901a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614905092915050565b600080611c3a84612889565b90506000611c478561290d565b905060018160ff161415611d4c57600160008681526020019081526020016000206000016001830360ff1681548110611c7c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d47576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f7420796f7572207475726e0000000000000000000000000000000000000081525060200191505060405180910390fd5b611e59565b60028160ff161415611e4f57600160008681526020019081526020016000206000018260020360ff1681548110611d7f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f4e6f7420796f7572207475726e0000000000000000000000000000000000000081525060200191505060405180910390fd5b611e58565b6000611e5757fe5b5b5b6002845114611ed0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f696e76616c696420616374696f6e206c656e677468000000000000000000000081525060200191505060405180910390fd5b600084600081518110611edf57fe5b602001015160f81c60f81b60f81c9050600085600181518110611efe57fe5b602001015160f81c60f81b60f81c9050611f188282612991565b611f8a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f6f7574206f6620626f756e64617279000000000000000000000000000000000081525060200191505060405180910390fd5b60006003600089815260200190815260200160002090506000611fad84846129b7565b905060008260000182815460018160011615610100020316600290048110611fd157fe5b815460011615611ff05790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c60ff161461208f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f736c6f74206973206f636375706965640000000000000000000000000000000081525060200191505060405180910390fd5b8560f81b82600001828154600181600116156101000203166002900481106120b357fe5b8154600116156120d25790600052602060002090602091828204019190065b601f036101000a81548160ff021916907f01000000000000000000000000000000000000000000000000000000000000008404021790555081600101600081819054906101000a900461ffff168092919060010191906101000a81548161ffff021916908361ffff1602179055505081600101600281819054906101000a900461ffff168092919060010191906101000a81548161ffff021916908361ffff160217905550506060826000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122125780601f106121e757610100808354040283529160200191612212565b820191906000526020600020905b8154815290600101906020018083116121f557829003601f168201915b50505050509050612228818686600160006129cd565b8061223e575061223d818686600060016129cd565b5b8061225357506122528186866001806129cd565b5b80612288575061228781868660017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6129cd565b5b156122a7576122978a886127a2565b6001975050505050505050612378565b60e18360010160009054906101000a900461ffff1661ffff1614806122f35750600260019054906101000a900460ff1660ff168360010160029054906101000a900461ffff1661ffff16115b15612340576003600160008c815260200190815260200160002060040160006101000a81548160ff0219169083600381111561232b57fe5b021790555061233b8a6000612a61565b61236c565b600160ff168760ff16141561235f5761235a8a6002612a61565b61236b565b61236a8a6001612a61565b5b5b60019750505050505050505b92915050565b612386612d63565b600182511161239457600080fd5b8181602001819052506000816000018181525050919050565b6060600083600001519050600183016040519080825280602002602001820160405280156123ea5781602001602082028038833980820191505090505b5091506000805b6123fa86612452565b1561243f5761240886612467565b8092508193505050600184838151811061241e57fe5b60200260200101818151019150818152505061243a8682612554565b6123f1565b8286600001818152505050505092915050565b60008160200151518260000151109050919050565b60008060006124758461271c565b90506008818161248157fe5b04925060078116600581111561249357fe5b915050915091565b606060006124a88361271c565b905060008184600001510190508360200151518111156124c757600080fd5b816040519080825280601f01601f1916602001820160405280156124fa5781602001600182028038833980820191505090505b50925060608460200151905060008086600001519050602086019150806020840101905060008090505b8581101561253f578082015181840152602081019050612524565b50838760000181815250505050505050919050565b6000600581111561256157fe5b81600581111561256d57fe5b14156125825761257c8261271c565b506125e0565b6002600581111561258f57fe5b81600581111561259b57fe5b14156125da5760006125ac8361271c565b905080836000018181510191508181525050826020015151836000015111156125d457600080fd5b506125df565b600080fd5b5b5050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b600060418251146126505760009050612716565b60008060006020850151925060408501519150606085015160001a9050601b8160ff16101561268057601b810190505b601b8160ff16141580156126985750601c8160ff1614155b156126a95760009350505050612716565b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015612706573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b60008060608360200151905083600001519250826020820101519150600080935060008090505b600a8110156127975783811a915060078102607f8316901b85179450600060808316141561278a57600181018660000181815101915081815250508494505050505061279d565b8080600101915050612743565b50600080fd5b919050565b8060ff166000111580156127ba575060028160ff1611155b61282c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c69642077696e6e657220737461746500000000000000000000000081525060200191505060405180910390fd5b6128368282612af3565b60008160ff16146128855761284c826000612a61565b60036001600084815260200190815260200160002060040160006101000a81548160ff0219169083600381111561287f57fe5b02179055505b5050565b60006003600083815260200190815260200160002060000160018154600181600116156101000203166002900481106128be57fe5b8154600116156128dd5790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c9050919050565b600060036000838152602001908152602001600020600001600281546001816001161561010002031660029004811061294257fe5b8154600116156129615790600052602060002090602091828204019190065b9054901a7f01000000000000000000000000000000000000000000000000000000000000000260f81c9050919050565b6000600f60ff168360ff161080156129af5750600f60ff168260ff16105b905092915050565b60008183600f026003010160ff16905092915050565b600080600090506129e18787878787612b85565b810190506001612a38888888887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02887fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02612b85565b038101905060058160ff1610612a52576001915050612a58565b60009150505b95945050505050565b8060f81b600360008481526020019081526020016000206000016001815460018160011615610100020316600290048110612a9857fe5b815460011615612ab75790600052602060002090602091828204019190065b601f036101000a81548160ff021916907f0100000000000000000000000000000000000000000000000000000000000000840402179055505050565b8060f81b600360008481526020019081526020016000206000016000815460018160011615610100020316600290048110612b2a57fe5b815460011615612b495790600052602060002090602091828204019190065b601f036101000a81548160ff021916907f0100000000000000000000000000000000000000000000000000000000000000840402179055505050565b600080600190505b60058160ff1611612c6f5760008160ff1685028760000b01905060008260ff1685028760000b019050612bc08282612991565b8015612c4d575088612bd289896129b7565b81518110612bdc57fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191689612c1484846129b7565b81518110612c1e57fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b15612c5d57600183019250612c68565b829350505050612c71565b5050612b8d565b505b95945050505050565b604051806040016040528060608152602001606081525090565b6040518060800160405280600081526020016000815260200160608152602001600081525090565b828054828255906000526020600020908101928215612d35579160200282015b82811115612d345782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190612cdc565b5b509050612d429190612dfd565b5090565b604051806040016040528060008019168152602001606081525090565b604051806040016040528060008152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612dbe57805160ff1916838001178555612dec565b82800160010185558215612dec579182015b82811115612deb578251825591602001919060010190612dd0565b5b509050612df99190612e40565b5090565b612e3d91905b80821115612e3957600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101612e03565b5090565b90565b612e6291905b80821115612e5e576000816000905550600101612e46565b5090565b9056fea165627a7a72305820c801bcde661f1fc80ad421a95e4db04852738b81313077640d20e3ef73557d620029", -} - -// MultiGomokuABI is the input ABI used to generate the binding from. -// Deprecated: Use MultiGomokuMetaData.ABI instead. -var MultiGomokuABI = MultiGomokuMetaData.ABI - -// MultiGomokuBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use MultiGomokuMetaData.Bin instead. -var MultiGomokuBin = MultiGomokuMetaData.Bin - -// DeployMultiGomoku deploys a new Ethereum contract, binding an instance of MultiGomoku to it. -func DeployMultiGomoku(auth *bind.TransactOpts, backend bind.ContractBackend, _minStoneOffchain uint8, _maxStoneOnchain uint8) (common.Address, *types.Transaction, *MultiGomoku, error) { - parsed, err := MultiGomokuMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(MultiGomokuBin), backend, _minStoneOffchain, _maxStoneOnchain) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &MultiGomoku{MultiGomokuCaller: MultiGomokuCaller{contract: contract}, MultiGomokuTransactor: MultiGomokuTransactor{contract: contract}, MultiGomokuFilterer: MultiGomokuFilterer{contract: contract}}, nil -} - -// MultiGomoku is an auto generated Go binding around an Ethereum contract. -type MultiGomoku struct { - MultiGomokuCaller // Read-only binding to the contract - MultiGomokuTransactor // Write-only binding to the contract - MultiGomokuFilterer // Log filterer for contract events -} - -// MultiGomokuCaller is an auto generated read-only Go binding around an Ethereum contract. -type MultiGomokuCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MultiGomokuTransactor is an auto generated write-only Go binding around an Ethereum contract. -type MultiGomokuTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MultiGomokuFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type MultiGomokuFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// MultiGomokuSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type MultiGomokuSession struct { - Contract *MultiGomoku // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// MultiGomokuCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type MultiGomokuCallerSession struct { - Contract *MultiGomokuCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// MultiGomokuTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type MultiGomokuTransactorSession struct { - Contract *MultiGomokuTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// MultiGomokuRaw is an auto generated low-level Go binding around an Ethereum contract. -type MultiGomokuRaw struct { - Contract *MultiGomoku // Generic contract binding to access the raw methods on -} - -// MultiGomokuCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type MultiGomokuCallerRaw struct { - Contract *MultiGomokuCaller // Generic read-only contract binding to access the raw methods on -} - -// MultiGomokuTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type MultiGomokuTransactorRaw struct { - Contract *MultiGomokuTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewMultiGomoku creates a new instance of MultiGomoku, bound to a specific deployed contract. -func NewMultiGomoku(address common.Address, backend bind.ContractBackend) (*MultiGomoku, error) { - contract, err := bindMultiGomoku(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &MultiGomoku{MultiGomokuCaller: MultiGomokuCaller{contract: contract}, MultiGomokuTransactor: MultiGomokuTransactor{contract: contract}, MultiGomokuFilterer: MultiGomokuFilterer{contract: contract}}, nil -} - -// NewMultiGomokuCaller creates a new read-only instance of MultiGomoku, bound to a specific deployed contract. -func NewMultiGomokuCaller(address common.Address, caller bind.ContractCaller) (*MultiGomokuCaller, error) { - contract, err := bindMultiGomoku(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &MultiGomokuCaller{contract: contract}, nil -} - -// NewMultiGomokuTransactor creates a new write-only instance of MultiGomoku, bound to a specific deployed contract. -func NewMultiGomokuTransactor(address common.Address, transactor bind.ContractTransactor) (*MultiGomokuTransactor, error) { - contract, err := bindMultiGomoku(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &MultiGomokuTransactor{contract: contract}, nil -} - -// NewMultiGomokuFilterer creates a new log filterer instance of MultiGomoku, bound to a specific deployed contract. -func NewMultiGomokuFilterer(address common.Address, filterer bind.ContractFilterer) (*MultiGomokuFilterer, error) { - contract, err := bindMultiGomoku(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &MultiGomokuFilterer{contract: contract}, nil -} - -// bindMultiGomoku binds a generic wrapper to an already deployed contract. -func bindMultiGomoku(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := MultiGomokuMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_MultiGomoku *MultiGomokuRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _MultiGomoku.Contract.MultiGomokuCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_MultiGomoku *MultiGomokuRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _MultiGomoku.Contract.MultiGomokuTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_MultiGomoku *MultiGomokuRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _MultiGomoku.Contract.MultiGomokuTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_MultiGomoku *MultiGomokuCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _MultiGomoku.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_MultiGomoku *MultiGomokuTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _MultiGomoku.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_MultiGomoku *MultiGomokuTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _MultiGomoku.Contract.contract.Transact(opts, method, params...) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuCaller) GetActionDeadline(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getActionDeadline", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuSession) GetActionDeadline(_session [32]byte) (*big.Int, error) { - return _MultiGomoku.Contract.GetActionDeadline(&_MultiGomoku.CallOpts, _session) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuCallerSession) GetActionDeadline(_session [32]byte) (*big.Int, error) { - return _MultiGomoku.Contract.GetActionDeadline(&_MultiGomoku.CallOpts, _session) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_MultiGomoku *MultiGomokuCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_MultiGomoku *MultiGomokuSession) GetOutcome(_query []byte) (bool, error) { - return _MultiGomoku.Contract.GetOutcome(&_MultiGomoku.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_MultiGomoku *MultiGomokuCallerSession) GetOutcome(_query []byte) (bool, error) { - return _MultiGomoku.Contract.GetOutcome(&_MultiGomoku.CallOpts, _query) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuCaller) GetSeqNum(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getSeqNum", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuSession) GetSeqNum(_session [32]byte) (*big.Int, error) { - return _MultiGomoku.Contract.GetSeqNum(&_MultiGomoku.CallOpts, _session) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuCallerSession) GetSeqNum(_session [32]byte) (*big.Int, error) { - return _MultiGomoku.Contract.GetSeqNum(&_MultiGomoku.CallOpts, _session) -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_MultiGomoku *MultiGomokuCaller) GetSessionID(opts *bind.CallOpts, _nonce *big.Int, _signers []common.Address) ([32]byte, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getSessionID", _nonce, _signers) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_MultiGomoku *MultiGomokuSession) GetSessionID(_nonce *big.Int, _signers []common.Address) ([32]byte, error) { - return _MultiGomoku.Contract.GetSessionID(&_MultiGomoku.CallOpts, _nonce, _signers) -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_MultiGomoku *MultiGomokuCallerSession) GetSessionID(_nonce *big.Int, _signers []common.Address) ([32]byte, error) { - return _MultiGomoku.Contract.GetSessionID(&_MultiGomoku.CallOpts, _nonce, _signers) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuCaller) GetSettleFinalizedTime(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getSettleFinalizedTime", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuSession) GetSettleFinalizedTime(_session [32]byte) (*big.Int, error) { - return _MultiGomoku.Contract.GetSettleFinalizedTime(&_MultiGomoku.CallOpts, _session) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_MultiGomoku *MultiGomokuCallerSession) GetSettleFinalizedTime(_session [32]byte) (*big.Int, error) { - return _MultiGomoku.Contract.GetSettleFinalizedTime(&_MultiGomoku.CallOpts, _session) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_MultiGomoku *MultiGomokuCaller) GetState(opts *bind.CallOpts, _session [32]byte, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getState", _session, _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_MultiGomoku *MultiGomokuSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _MultiGomoku.Contract.GetState(&_MultiGomoku.CallOpts, _session, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_MultiGomoku *MultiGomokuCallerSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _MultiGomoku.Contract.GetState(&_MultiGomoku.CallOpts, _session, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_MultiGomoku *MultiGomokuCaller) GetStatus(opts *bind.CallOpts, _session [32]byte) (uint8, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "getStatus", _session) - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_MultiGomoku *MultiGomokuSession) GetStatus(_session [32]byte) (uint8, error) { - return _MultiGomoku.Contract.GetStatus(&_MultiGomoku.CallOpts, _session) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_MultiGomoku *MultiGomokuCallerSession) GetStatus(_session [32]byte) (uint8, error) { - return _MultiGomoku.Contract.GetStatus(&_MultiGomoku.CallOpts, _session) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_MultiGomoku *MultiGomokuCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_MultiGomoku *MultiGomokuSession) IsFinalized(_query []byte) (bool, error) { - return _MultiGomoku.Contract.IsFinalized(&_MultiGomoku.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_MultiGomoku *MultiGomokuCallerSession) IsFinalized(_query []byte) (bool, error) { - return _MultiGomoku.Contract.IsFinalized(&_MultiGomoku.CallOpts, _query) -} - -// MaxStoneOnchain is a free data retrieval call binding the contract method 0xc1a28656. -// -// Solidity: function maxStoneOnchain() view returns(uint8) -func (_MultiGomoku *MultiGomokuCaller) MaxStoneOnchain(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "maxStoneOnchain") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// MaxStoneOnchain is a free data retrieval call binding the contract method 0xc1a28656. -// -// Solidity: function maxStoneOnchain() view returns(uint8) -func (_MultiGomoku *MultiGomokuSession) MaxStoneOnchain() (uint8, error) { - return _MultiGomoku.Contract.MaxStoneOnchain(&_MultiGomoku.CallOpts) -} - -// MaxStoneOnchain is a free data retrieval call binding the contract method 0xc1a28656. -// -// Solidity: function maxStoneOnchain() view returns(uint8) -func (_MultiGomoku *MultiGomokuCallerSession) MaxStoneOnchain() (uint8, error) { - return _MultiGomoku.Contract.MaxStoneOnchain(&_MultiGomoku.CallOpts) -} - -// MinStoneOffchain is a free data retrieval call binding the contract method 0x7ca22157. -// -// Solidity: function minStoneOffchain() view returns(uint8) -func (_MultiGomoku *MultiGomokuCaller) MinStoneOffchain(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _MultiGomoku.contract.Call(opts, &out, "minStoneOffchain") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// MinStoneOffchain is a free data retrieval call binding the contract method 0x7ca22157. -// -// Solidity: function minStoneOffchain() view returns(uint8) -func (_MultiGomoku *MultiGomokuSession) MinStoneOffchain() (uint8, error) { - return _MultiGomoku.Contract.MinStoneOffchain(&_MultiGomoku.CallOpts) -} - -// MinStoneOffchain is a free data retrieval call binding the contract method 0x7ca22157. -// -// Solidity: function minStoneOffchain() view returns(uint8) -func (_MultiGomoku *MultiGomokuCallerSession) MinStoneOffchain() (uint8, error) { - return _MultiGomoku.Contract.MinStoneOffchain(&_MultiGomoku.CallOpts) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_MultiGomoku *MultiGomokuTransactor) ApplyAction(opts *bind.TransactOpts, _session [32]byte, _action []byte) (*types.Transaction, error) { - return _MultiGomoku.contract.Transact(opts, "applyAction", _session, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_MultiGomoku *MultiGomokuSession) ApplyAction(_session [32]byte, _action []byte) (*types.Transaction, error) { - return _MultiGomoku.Contract.ApplyAction(&_MultiGomoku.TransactOpts, _session, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_MultiGomoku *MultiGomokuTransactorSession) ApplyAction(_session [32]byte, _action []byte) (*types.Transaction, error) { - return _MultiGomoku.Contract.ApplyAction(&_MultiGomoku.TransactOpts, _session, _action) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_MultiGomoku *MultiGomokuTransactor) FinalizeOnActionTimeout(opts *bind.TransactOpts, _session [32]byte) (*types.Transaction, error) { - return _MultiGomoku.contract.Transact(opts, "finalizeOnActionTimeout", _session) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_MultiGomoku *MultiGomokuSession) FinalizeOnActionTimeout(_session [32]byte) (*types.Transaction, error) { - return _MultiGomoku.Contract.FinalizeOnActionTimeout(&_MultiGomoku.TransactOpts, _session) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_MultiGomoku *MultiGomokuTransactorSession) FinalizeOnActionTimeout(_session [32]byte) (*types.Transaction, error) { - return _MultiGomoku.Contract.FinalizeOnActionTimeout(&_MultiGomoku.TransactOpts, _session) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_MultiGomoku *MultiGomokuTransactor) IntendSettle(opts *bind.TransactOpts, _stateProof []byte) (*types.Transaction, error) { - return _MultiGomoku.contract.Transact(opts, "intendSettle", _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_MultiGomoku *MultiGomokuSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _MultiGomoku.Contract.IntendSettle(&_MultiGomoku.TransactOpts, _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_MultiGomoku *MultiGomokuTransactorSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _MultiGomoku.Contract.IntendSettle(&_MultiGomoku.TransactOpts, _stateProof) -} - -// MultiGomokuIntendSettleIterator is returned from FilterIntendSettle and is used to iterate over the raw logs and unpacked data for IntendSettle events raised by the MultiGomoku contract. -type MultiGomokuIntendSettleIterator struct { - Event *MultiGomokuIntendSettle // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *MultiGomokuIntendSettleIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(MultiGomokuIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(MultiGomokuIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *MultiGomokuIntendSettleIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *MultiGomokuIntendSettleIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// MultiGomokuIntendSettle represents a IntendSettle event raised by the MultiGomoku contract. -type MultiGomokuIntendSettle struct { - Session [32]byte - Seq *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIntendSettle is a free log retrieval operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_MultiGomoku *MultiGomokuFilterer) FilterIntendSettle(opts *bind.FilterOpts, session [][32]byte) (*MultiGomokuIntendSettleIterator, error) { - - var sessionRule []interface{} - for _, sessionItem := range session { - sessionRule = append(sessionRule, sessionItem) - } - - logs, sub, err := _MultiGomoku.contract.FilterLogs(opts, "IntendSettle", sessionRule) - if err != nil { - return nil, err - } - return &MultiGomokuIntendSettleIterator{contract: _MultiGomoku.contract, event: "IntendSettle", logs: logs, sub: sub}, nil -} - -// WatchIntendSettle is a free log subscription operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_MultiGomoku *MultiGomokuFilterer) WatchIntendSettle(opts *bind.WatchOpts, sink chan<- *MultiGomokuIntendSettle, session [][32]byte) (event.Subscription, error) { - - var sessionRule []interface{} - for _, sessionItem := range session { - sessionRule = append(sessionRule, sessionItem) - } - - logs, sub, err := _MultiGomoku.contract.WatchLogs(opts, "IntendSettle", sessionRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(MultiGomokuIntendSettle) - if err := _MultiGomoku.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIntendSettle is a log parse operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_MultiGomoku *MultiGomokuFilterer) ParseIntendSettle(log types.Log) (*MultiGomokuIntendSettle, error) { - event := new(MultiGomokuIntendSettle) - if err := _MultiGomoku.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/testing/testapp/multisessionapp.go b/testing/testapp/multisessionapp.go deleted file mode 100644 index 33fc851..0000000 --- a/testing/testapp/multisessionapp.go +++ /dev/null @@ -1,659 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package testapp - -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" -) - -// 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 -) - -// SimpleMultiSessionAppMetaData contains all meta data concerning the SimpleMultiSessionApp contract. -var SimpleMultiSessionAppMetaData = &bind.MetaData{ - ABI: "[{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getSettleFinalizedTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_stateProof\",\"type\":\"bytes\"}],\"name\":\"intendSettle\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getSeqNum\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_signers\",\"type\":\"address[]\"}],\"name\":\"getSessionID\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"finalizeOnActionTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getActionDeadline\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_action\",\"type\":\"bytes\"}],\"name\":\"applyAction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_playerNum\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"session\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"seq\",\"type\":\"uint256\"}],\"name\":\"IntendSettle\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50604051602080611e9f8339810180604052602081101561003057600080fd5b81019080805190602001909291905050508080806000800181905550505050611e418061005e6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80635de28ae0116100715780635de28ae0146102f3578063b89fa28b14610343578063bcdbda9414610371578063cab9244614610402578063ea4ba8eb14610444578063f3c77192146104d5576100a9565b806309b65d86146100ae578063130d33fe146100f057806329dd2f8e146101695780633b6de66f1461021a5780634d8bedec1461025c575b600080fd5b6100da600480360360208110156100c457600080fd5b8101908080359060200190929190505050610558565b6040518082815260200191505060405180910390f35b6101676004803603602081101561010657600080fd5b810190808035906020019064010000000081111561012357600080fd5b82018360208201111561013557600080fd5b8035906020019184600183028401116401000000008311171561015757600080fd5b90919293919293905050506105c4565b005b61019f6004803603604081101561017f57600080fd5b8101908080359060200190929190803590602001909291905050506109cb565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101df5780820151818401526020810190506101c4565b50505050905090810190601f16801561020c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102466004803603602081101561023057600080fd5b8101908080359060200190929190505050610a3e565b6040518082815260200191505060405180910390f35b6102dd6004803603604081101561027257600080fd5b81019080803590602001909291908035906020019064010000000081111561029957600080fd5b8201836020820111156102ab57600080fd5b803590602001918460208302840111640100000000831117156102cd57600080fd5b9091929391929390505050610a5e565b6040518082815260200191505060405180910390f35b61031f6004803603602081101561030957600080fd5b8101908080359060200190929190505050610ac7565b6040518082600381111561032f57fe5b60ff16815260200191505060405180910390f35b61036f6004803603602081101561035957600080fd5b8101908080359060200190929190505050610af4565b005b6103e86004803603602081101561038757600080fd5b81019080803590602001906401000000008111156103a457600080fd5b8201836020820111156103b657600080fd5b803590602001918460018302840111640100000000831117156103d857600080fd5b9091929391929390505050610ba9565b604051808215151515815260200191505060405180910390f35b61042e6004803603602081101561041857600080fd5b8101908080359060200190929190505050610c40565b6040518082815260200191505060405180910390f35b6104bb6004803603602081101561045a57600080fd5b810190808035906020019064010000000081111561047757600080fd5b82018360208201111561048957600080fd5b803590602001918460018302840111640100000000831117156104ab57600080fd5b9091929391929390505050610d24565b604051808215151515815260200191505060405180910390f35b610556600480360360408110156104eb57600080fd5b81019080803590602001909291908035906020019064010000000081111561051257600080fd5b82018360208201111561052457600080fd5b8035906020019184600183028401116401000000008311171561054657600080fd5b9091929391929390505050610d98565b005b60006001600381111561056757fe5b6001600084815260200190815260200160002060040160009054906101000a900460ff16600381111561059657fe5b14156105ba57600160008381526020019081526020016000206003015490506105bf565b600090505b919050565b6105cc611ccf565b61061983838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610fcf565b90506060610631826000015183602001516001611146565b905060008001548151146106ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f696e76616c6964206e756d626572206f6620706c61796572730000000000000081525060200191505060405180910390fd5b6106b5611ce9565b6106c2836000015161135d565b905060008160000151836040516020018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156107185780820151818401526020810190506106fd565b50505050905001935050505060405160208183030381529060405280519060200120905060006001600083815260200190815260200160002090506000600381111561076057fe5b8160040160009054906101000a900460ff16600381111561077d57fe5b141561079d578381600001908051906020019061079b929190611d11565b505b6003808111156107a957fe5b8160040160009054906101000a900460ff1660038111156107c657fe5b141561083a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f73746174652069732066696e616c697a6564000000000000000000000000000081525060200191505060405180910390fd5b82602001518160010154106108b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f696e76616c69642073657175656e6365206e756d62657200000000000000000081525060200191505060405180910390fd5b8260200151816001018190555060018160040160006101000a81548160ff021916908360038111156108e557fe5b02179055508260600151816002018190555082606001514301816003018190555061091482846040015161144b565b610986576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f737461746520757064617465206661696c65640000000000000000000000000081525060200191505060405180910390fd5b817f82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b82600101546040518082815260200191505060405180910390a250505050505050565b60608060206040519080825280601f01601f191660200182016040528015610a025781602001600182028038833980820191505090505b50905060006002600086815260200190815260200160002060000160009054906101000a900460ff169050806020830152819250505092915050565b600060016000838152602001908152602001600020600101549050919050565b600083838360405160200180848152602001806020018281038252848482818152602001925060200280828437600081840152601f19601f8201169050808301925050509450505050506040516020818303038152906040528051906020012090509392505050565b60006001600083815260200190815260200160002060040160009054906101000a900460ff169050919050565b600060016000838152602001908152602001600020905060008160040160009054906101000a900460ff16905060008260030154905060026003811115610b3757fe5b826003811115610b4357fe5b1415610b5a57804311610b5557600080fd5b610b99565b60016003811115610b6757fe5b826003811115610b7357fe5b1415610b9057826002015481014311610b8b57600080fd5b610b98565b505050610ba6565b5b610ba284611592565b5050505b50565b600080610bf984848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506115cd565b9050600380811115610c0757fe5b6001600083815260200190815260200160002060040160009054906101000a900460ff166003811115610c3657fe5b1491505092915050565b600060026003811115610c4f57fe5b6001600084815260200190815260200160002060040160009054906101000a900460ff166003811115610c7e57fe5b1415610ca25760016000838152602001908152602001600020600301549050610d1f565b60016003811115610caf57fe5b6001600084815260200190815260200160002060040160009054906101000a900460ff166003811115610cde57fe5b1415610d1a5760016000838152602001908152602001600020600201546001600084815260200190815260200160002060030154019050610d1f565b600090505b919050565b6000610d2e611d9b565b610d7b84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506115e9565b9050610d8f8160000151826020015161169d565b91505092915050565b6000600160008581526020019081526020016000209050600380811115610dbb57fe5b8160040160009054906101000a900460ff166003811115610dd857fe5b1415610e4c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b60016003811115610e5957fe5b8160040160009054906101000a900460ff166003811115610e7657fe5b148015610e865750438160030154105b15610eb25760028160040160006101000a81548160ff02191690836003811115610eac57fe5b02179055505b60026003811115610ebf57fe5b8160040160009054906101000a900460ff166003811115610edc57fe5b14610f4f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f617070206e6f7420696e20616374696f6e206d6f64650000000000000000000081525060200191505060405180910390fd5b8060010160008154809291906001019190505550806002015443018160030181905550610fc08484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611764565b610fc957600080fd5b50505050565b610fd7611ccf565b610fdf611db8565b610fe8836118ab565b905060606110006002836118da90919063ffffffff16565b90508060028151811061100f57fe5b602002602001015160405190808252806020026020018201604052801561104a57816020015b60608152602001906001900390816110355790505b50836020018190525060008160028151811061106257fe5b6020026020010181815250506000805b61107b8461197f565b1561113d5761108984611994565b809250819350505060001561109d57611138565b60018214156110bc576110af846119c8565b8560000181905250611137565b6002821415611122576110ce846119c8565b8560200151846002815181106110e057fe5b6020026020010151815181106110f257fe5b60200260200101819052508260028151811061110a57fe5b60200260200101805180919060010181525050611136565b6111358185611a8190919063ffffffff16565b5b5b5b611072565b50505050919050565b60608083516040519080825280602002602001820160405280156111795781602001602082028038833980820191505090505b50905060006111f8866040516020018082805190602001908083835b602083106111b85780518252602082019150602081019050602083039250611195565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405280519060200120611b11565b9050600080905060008090505b865181101561134f5761122b8388838151811061121e57fe5b6020026020010151611b69565b84828151811061123757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508515611342578173ffffffffffffffffffffffffffffffffffffffff1684828151811061129a57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161161132b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f7369676e657273206e6f7420696e20617363656e64696e67206f72646572000081525060200191505060405180910390fd5b83818151811061133757fe5b602002602001015191505b8080600101915050611205565b508293505050509392505050565b611365611ce9565b61136d611db8565b611376836118ab565b90506000805b6113858361197f565b156114435761139383611994565b80925081935050506000156113a75761143e565b60018214156113c7576113b983611c49565b84600001818152505061143d565b60028214156113e7576113d983611c49565b84602001818152505061143c565b6003821415611406576113f9836119c8565b846040018190525061143b565b60048214156114265761141883611c49565b84606001818152505061143a565b6114398184611a8190919063ffffffff16565b5b5b5b5b5b61137c565b505050919050565b600060018251146114c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207374617465206c656e67746800000000000000000000000081525060200191505060405180910390fd5b6000600260008581526020019081526020016000209050826000815181106114e857fe5b602001015160f81c60f81b60f81c8160000160006101000a81548160ff021916908360ff16021790555060018160000160009054906101000a900460ff1660ff161480611549575060028160000160009054906101000a900460ff1660ff16145b156115875760036001600086815260200190815260200160002060040160006101000a81548160ff0219169083600381111561158157fe5b02179055505b600191505092915050565b60036001600083815260200190815260200160002060040160006101000a81548160ff021916908360038111156115c557fe5b021790555050565b600060208251146115dd57600080fd5b60208201519050919050565b6115f1611d9b565b6115f9611db8565b611602836118ab565b90506000805b6116118361197f565b156116955761161f83611994565b809250819350505060001561163357611690565b600182141561165b5761164d611648846119c8565b6115cd565b84600001818152505061168f565b600282141561167a5761166d836119c8565b846020018190525061168e565b61168d8184611a8190919063ffffffff16565b5b5b5b611608565b505050919050565b60006001825114611716576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207175657279206c656e67746800000000000000000000000081525060200191505060405180910390fd5b8160008151811061172357fe5b602001015160f81c60f81b60f81c60ff166002600085815260200190815260200160002060000160009054906101000a900460ff1660ff1614905092915050565b600060018251146117dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f696e76616c696420616374696f6e206c656e677468000000000000000000000081525060200191505060405180910390fd5b60006002600085815260200190815260200160002090508260008151811061180157fe5b602001015160f81c60f81b60f81c8160000160006101000a81548160ff021916908360ff16021790555060018160000160009054906101000a900460ff1660ff161480611862575060028160000160009054906101000a900460ff1660ff16145b156118a05760036001600086815260200190815260200160002060040160006101000a81548160ff0219169083600381111561189a57fe5b02179055505b600191505092915050565b6118b3611db8565b60018251116118c157600080fd5b8181602001819052506000816000018181525050919050565b6060600083600001519050600183016040519080825280602002602001820160405280156119175781602001602082028038833980820191505090505b5091506000805b6119278661197f565b1561196c5761193586611994565b8092508193505050600184838151811061194b57fe5b6020026020010181815101915081815250506119678682611a81565b61191e565b8286600001818152505050505092915050565b60008160200151518260000151109050919050565b60008060006119a284611c49565b9050600881816119ae57fe5b0492506007811660058111156119c057fe5b915050915091565b606060006119d583611c49565b905060008184600001510190508360200151518111156119f457600080fd5b816040519080825280601f01601f191660200182016040528015611a275781602001600182028038833980820191505090505b50925060608460200151905060008086600001519050602086019150806020840101905060008090505b85811015611a6c578082015181840152602081019050611a51565b50838760000181815250505050505050919050565b60006005811115611a8e57fe5b816005811115611a9a57fe5b1415611aaf57611aa982611c49565b50611b0d565b60026005811115611abc57fe5b816005811115611ac857fe5b1415611b07576000611ad983611c49565b90508083600001818151019150818152505082602001515183600001511115611b0157600080fd5b50611b0c565b600080fd5b5b5050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b60006041825114611b7d5760009050611c43565b60008060006020850151925060408501519150606085015160001a9050601b8160ff161015611bad57601b810190505b601b8160ff1614158015611bc55750601c8160ff1614155b15611bd65760009350505050611c43565b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611c33573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b60008060608360200151905083600001519250826020820101519150600080935060008090505b600a811015611cc45783811a915060078102607f8316901b851794506000608083161415611cb7576001810186600001818151019150818152505084945050505050611cca565b8080600101915050611c70565b50600080fd5b919050565b604051806040016040528060608152602001606081525090565b6040518060800160405280600081526020016000815260200160608152602001600081525090565b828054828255906000526020600020908101928215611d8a579160200282015b82811115611d895782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190611d31565b5b509050611d979190611dd2565b5090565b604051806040016040528060008019168152602001606081525090565b604051806040016040528060008152602001606081525090565b611e1291905b80821115611e0e57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101611dd8565b5090565b9056fea165627a7a723058205e5fba456536ddf9f1ce69a4488227c0f3b08c317467eb5d659a10f907e41eb40029", -} - -// SimpleMultiSessionAppABI is the input ABI used to generate the binding from. -// Deprecated: Use SimpleMultiSessionAppMetaData.ABI instead. -var SimpleMultiSessionAppABI = SimpleMultiSessionAppMetaData.ABI - -// SimpleMultiSessionAppBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use SimpleMultiSessionAppMetaData.Bin instead. -var SimpleMultiSessionAppBin = SimpleMultiSessionAppMetaData.Bin - -// DeploySimpleMultiSessionApp deploys a new Ethereum contract, binding an instance of SimpleMultiSessionApp to it. -func DeploySimpleMultiSessionApp(auth *bind.TransactOpts, backend bind.ContractBackend, _playerNum *big.Int) (common.Address, *types.Transaction, *SimpleMultiSessionApp, error) { - parsed, err := SimpleMultiSessionAppMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SimpleMultiSessionAppBin), backend, _playerNum) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SimpleMultiSessionApp{SimpleMultiSessionAppCaller: SimpleMultiSessionAppCaller{contract: contract}, SimpleMultiSessionAppTransactor: SimpleMultiSessionAppTransactor{contract: contract}, SimpleMultiSessionAppFilterer: SimpleMultiSessionAppFilterer{contract: contract}}, nil -} - -// SimpleMultiSessionApp is an auto generated Go binding around an Ethereum contract. -type SimpleMultiSessionApp struct { - SimpleMultiSessionAppCaller // Read-only binding to the contract - SimpleMultiSessionAppTransactor // Write-only binding to the contract - SimpleMultiSessionAppFilterer // Log filterer for contract events -} - -// SimpleMultiSessionAppCaller is an auto generated read-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleMultiSessionAppTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleMultiSessionAppFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SimpleMultiSessionAppFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleMultiSessionAppSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SimpleMultiSessionAppSession struct { - Contract *SimpleMultiSessionApp // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleMultiSessionAppCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SimpleMultiSessionAppCallerSession struct { - Contract *SimpleMultiSessionAppCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SimpleMultiSessionAppTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SimpleMultiSessionAppTransactorSession struct { - Contract *SimpleMultiSessionAppTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleMultiSessionAppRaw is an auto generated low-level Go binding around an Ethereum contract. -type SimpleMultiSessionAppRaw struct { - Contract *SimpleMultiSessionApp // Generic contract binding to access the raw methods on -} - -// SimpleMultiSessionAppCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppCallerRaw struct { - Contract *SimpleMultiSessionAppCaller // Generic read-only contract binding to access the raw methods on -} - -// SimpleMultiSessionAppTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppTransactorRaw struct { - Contract *SimpleMultiSessionAppTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSimpleMultiSessionApp creates a new instance of SimpleMultiSessionApp, bound to a specific deployed contract. -func NewSimpleMultiSessionApp(address common.Address, backend bind.ContractBackend) (*SimpleMultiSessionApp, error) { - contract, err := bindSimpleMultiSessionApp(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SimpleMultiSessionApp{SimpleMultiSessionAppCaller: SimpleMultiSessionAppCaller{contract: contract}, SimpleMultiSessionAppTransactor: SimpleMultiSessionAppTransactor{contract: contract}, SimpleMultiSessionAppFilterer: SimpleMultiSessionAppFilterer{contract: contract}}, nil -} - -// NewSimpleMultiSessionAppCaller creates a new read-only instance of SimpleMultiSessionApp, bound to a specific deployed contract. -func NewSimpleMultiSessionAppCaller(address common.Address, caller bind.ContractCaller) (*SimpleMultiSessionAppCaller, error) { - contract, err := bindSimpleMultiSessionApp(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppCaller{contract: contract}, nil -} - -// NewSimpleMultiSessionAppTransactor creates a new write-only instance of SimpleMultiSessionApp, bound to a specific deployed contract. -func NewSimpleMultiSessionAppTransactor(address common.Address, transactor bind.ContractTransactor) (*SimpleMultiSessionAppTransactor, error) { - contract, err := bindSimpleMultiSessionApp(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppTransactor{contract: contract}, nil -} - -// NewSimpleMultiSessionAppFilterer creates a new log filterer instance of SimpleMultiSessionApp, bound to a specific deployed contract. -func NewSimpleMultiSessionAppFilterer(address common.Address, filterer bind.ContractFilterer) (*SimpleMultiSessionAppFilterer, error) { - contract, err := bindSimpleMultiSessionApp(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppFilterer{contract: contract}, nil -} - -// bindSimpleMultiSessionApp binds a generic wrapper to an already deployed contract. -func bindSimpleMultiSessionApp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SimpleMultiSessionAppMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleMultiSessionApp *SimpleMultiSessionAppRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleMultiSessionApp.Contract.SimpleMultiSessionAppCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleMultiSessionApp *SimpleMultiSessionAppRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.SimpleMultiSessionAppTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleMultiSessionApp *SimpleMultiSessionAppRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.SimpleMultiSessionAppTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleMultiSessionApp.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.contract.Transact(opts, method, params...) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetActionDeadline(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getActionDeadline", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetActionDeadline(_session [32]byte) (*big.Int, error) { - return _SimpleMultiSessionApp.Contract.GetActionDeadline(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xcab92446. -// -// Solidity: function getActionDeadline(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetActionDeadline(_session [32]byte) (*big.Int, error) { - return _SimpleMultiSessionApp.Contract.GetActionDeadline(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleMultiSessionApp.Contract.GetOutcome(&_SimpleMultiSessionApp.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleMultiSessionApp.Contract.GetOutcome(&_SimpleMultiSessionApp.CallOpts, _query) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetSeqNum(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getSeqNum", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetSeqNum(_session [32]byte) (*big.Int, error) { - return _SimpleMultiSessionApp.Contract.GetSeqNum(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x3b6de66f. -// -// Solidity: function getSeqNum(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetSeqNum(_session [32]byte) (*big.Int, error) { - return _SimpleMultiSessionApp.Contract.GetSeqNum(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetSessionID(opts *bind.CallOpts, _nonce *big.Int, _signers []common.Address) ([32]byte, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getSessionID", _nonce, _signers) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetSessionID(_nonce *big.Int, _signers []common.Address) ([32]byte, error) { - return _SimpleMultiSessionApp.Contract.GetSessionID(&_SimpleMultiSessionApp.CallOpts, _nonce, _signers) -} - -// GetSessionID is a free data retrieval call binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) pure returns(bytes32) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetSessionID(_nonce *big.Int, _signers []common.Address) ([32]byte, error) { - return _SimpleMultiSessionApp.Contract.GetSessionID(&_SimpleMultiSessionApp.CallOpts, _nonce, _signers) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetSettleFinalizedTime(opts *bind.CallOpts, _session [32]byte) (*big.Int, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getSettleFinalizedTime", _session) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetSettleFinalizedTime(_session [32]byte) (*big.Int, error) { - return _SimpleMultiSessionApp.Contract.GetSettleFinalizedTime(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0x09b65d86. -// -// Solidity: function getSettleFinalizedTime(bytes32 _session) view returns(uint256) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetSettleFinalizedTime(_session [32]byte) (*big.Int, error) { - return _SimpleMultiSessionApp.Contract.GetSettleFinalizedTime(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetState(opts *bind.CallOpts, _session [32]byte, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getState", _session, _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _SimpleMultiSessionApp.Contract.GetState(&_SimpleMultiSessionApp.CallOpts, _session, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _SimpleMultiSessionApp.Contract.GetState(&_SimpleMultiSessionApp.CallOpts, _session, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) GetStatus(opts *bind.CallOpts, _session [32]byte) (uint8, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "getStatus", _session) - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) GetStatus(_session [32]byte) (uint8, error) { - return _SimpleMultiSessionApp.Contract.GetStatus(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) GetStatus(_session [32]byte) (uint8, error) { - return _SimpleMultiSessionApp.Contract.GetStatus(&_SimpleMultiSessionApp.CallOpts, _session) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleMultiSessionApp.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleMultiSessionApp.Contract.IsFinalized(&_SimpleMultiSessionApp.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppCallerSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleMultiSessionApp.Contract.IsFinalized(&_SimpleMultiSessionApp.CallOpts, _query) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactor) ApplyAction(opts *bind.TransactOpts, _session [32]byte, _action []byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.contract.Transact(opts, "applyAction", _session, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) ApplyAction(_session [32]byte, _action []byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.ApplyAction(&_SimpleMultiSessionApp.TransactOpts, _session, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0xf3c77192. -// -// Solidity: function applyAction(bytes32 _session, bytes _action) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactorSession) ApplyAction(_session [32]byte, _action []byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.ApplyAction(&_SimpleMultiSessionApp.TransactOpts, _session, _action) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactor) FinalizeOnActionTimeout(opts *bind.TransactOpts, _session [32]byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.contract.Transact(opts, "finalizeOnActionTimeout", _session) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) FinalizeOnActionTimeout(_session [32]byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.FinalizeOnActionTimeout(&_SimpleMultiSessionApp.TransactOpts, _session) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xb89fa28b. -// -// Solidity: function finalizeOnActionTimeout(bytes32 _session) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactorSession) FinalizeOnActionTimeout(_session [32]byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.FinalizeOnActionTimeout(&_SimpleMultiSessionApp.TransactOpts, _session) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactor) IntendSettle(opts *bind.TransactOpts, _stateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.contract.Transact(opts, "intendSettle", _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.IntendSettle(&_SimpleMultiSessionApp.TransactOpts, _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_SimpleMultiSessionApp *SimpleMultiSessionAppTransactorSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionApp.Contract.IntendSettle(&_SimpleMultiSessionApp.TransactOpts, _stateProof) -} - -// SimpleMultiSessionAppIntendSettleIterator is returned from FilterIntendSettle and is used to iterate over the raw logs and unpacked data for IntendSettle events raised by the SimpleMultiSessionApp contract. -type SimpleMultiSessionAppIntendSettleIterator struct { - Event *SimpleMultiSessionAppIntendSettle // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleMultiSessionAppIntendSettleIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleMultiSessionAppIntendSettleIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleMultiSessionAppIntendSettleIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleMultiSessionAppIntendSettle represents a IntendSettle event raised by the SimpleMultiSessionApp contract. -type SimpleMultiSessionAppIntendSettle struct { - Session [32]byte - Seq *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIntendSettle is a free log retrieval operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppFilterer) FilterIntendSettle(opts *bind.FilterOpts, session [][32]byte) (*SimpleMultiSessionAppIntendSettleIterator, error) { - - var sessionRule []interface{} - for _, sessionItem := range session { - sessionRule = append(sessionRule, sessionItem) - } - - logs, sub, err := _SimpleMultiSessionApp.contract.FilterLogs(opts, "IntendSettle", sessionRule) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppIntendSettleIterator{contract: _SimpleMultiSessionApp.contract, event: "IntendSettle", logs: logs, sub: sub}, nil -} - -// WatchIntendSettle is a free log subscription operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppFilterer) WatchIntendSettle(opts *bind.WatchOpts, sink chan<- *SimpleMultiSessionAppIntendSettle, session [][32]byte) (event.Subscription, error) { - - var sessionRule []interface{} - for _, sessionItem := range session { - sessionRule = append(sessionRule, sessionItem) - } - - logs, sub, err := _SimpleMultiSessionApp.contract.WatchLogs(opts, "IntendSettle", sessionRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleMultiSessionAppIntendSettle) - if err := _SimpleMultiSessionApp.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIntendSettle is a log parse operation binding the contract event 0x82c4eeba939ff9358877334330e22a5cdb0472113cd14f90625ea634b60d2e5b. -// -// Solidity: event IntendSettle(bytes32 indexed session, uint256 seq) -func (_SimpleMultiSessionApp *SimpleMultiSessionAppFilterer) ParseIntendSettle(log types.Log) (*SimpleMultiSessionAppIntendSettle, error) { - event := new(SimpleMultiSessionAppIntendSettle) - if err := _SimpleMultiSessionApp.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/testing/testapp/multisessionappwithoracle.go b/testing/testapp/multisessionappwithoracle.go deleted file mode 100644 index 4a3394d..0000000 --- a/testing/testapp/multisessionappwithoracle.go +++ /dev/null @@ -1,968 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package testapp - -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" -) - -// 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 -) - -// SimpleMultiSessionAppWithOracleMetaData contains all meta data concerning the SimpleMultiSessionAppWithOracle contract. -var SimpleMultiSessionAppWithOracleMetaData = &bind.MetaData{ - ABI: "[{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleBySigTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_signers\",\"type\":\"address[]\"}],\"name\":\"getSessionID\",\"outputs\":[{\"name\":\"session\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"}],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidTurn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleByMoveTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_sigTimeout\",\"type\":\"uint256\"},{\"name\":\"_moveTimeout\",\"type\":\"uint256\"},{\"name\":\"_playerNum\",\"type\":\"uint256\"},{\"name\":\"_oracle\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"session\",\"type\":\"bytes32\"}],\"name\":\"SigTimeoutDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"session\",\"type\":\"bytes32\"}],\"name\":\"MoveTimeoutDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"session\",\"type\":\"bytes32\"}],\"name\":\"InvalidTurnDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"session\",\"type\":\"bytes32\"}],\"name\":\"InvalidStateDispute\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_session\",\"type\":\"bytes32\"},{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b506040516080806129848339810180604052608081101561003057600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291905050508383838383838383836000800181905550826000600101819055508160006002018190555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050505050505050506128a4806100e06000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063a428cd3b11610066578063a428cd3b146102e8578063bcdbda94146103b6578063ea4ba8eb14610447578063f26285b2146104d8578063fb3fe8061461055157610093565b80632141dbda1461009857806329dd2f8e146101115780634d8bedec146101c25780635de28ae014610298575b600080fd5b61010f600480360360208110156100ae57600080fd5b81019080803590602001906401000000008111156100cb57600080fd5b8201836020820111156100dd57600080fd5b803590602001918460018302840111640100000000831117156100ff57600080fd5b909192939192939050505061061f565b005b6101476004803603604081101561012757600080fd5b81019080803590602001909291908035906020019092919050505061086a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018757808201518184015260208101905061016c565b50505050905090810190601f1680156101b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610282600480360360408110156101d857600080fd5b8101908080359060200190929190803590602001906401000000008111156101ff57600080fd5b82018360208201111561021157600080fd5b8035906020019184602083028401116401000000008311171561023357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506108dd565b6040518082815260200191505060405180910390f35b6102c4600480360360208110156102ae57600080fd5b8101908080359060200190929190505050610982565b604051808260018111156102d457fe5b60ff16815260200191505060405180910390f35b6103b4600480360360408110156102fe57600080fd5b810190808035906020019064010000000081111561031b57600080fd5b82018360208201111561032d57600080fd5b8035906020019184600183028401116401000000008311171561034f57600080fd5b90919293919293908035906020019064010000000081111561037057600080fd5b82018360208201111561038257600080fd5b803590602001918460018302840111640100000000831117156103a457600080fd5b90919293919293905050506109af565b005b61042d600480360360208110156103cc57600080fd5b81019080803590602001906401000000008111156103e957600080fd5b8201836020820111156103fb57600080fd5b8035906020019184600183028401116401000000008311171561041d57600080fd5b9091929391929390505050610c3f565b604051808215151515815260200191505060405180910390f35b6104be6004803603602081101561045d57600080fd5b810190808035906020019064010000000081111561047a57600080fd5b82018360208201111561048c57600080fd5b803590602001918460018302840111640100000000831117156104ae57600080fd5b9091929391929390505050610cd6565b604051808215151515815260200191505060405180910390f35b61054f600480360360208110156104ee57600080fd5b810190808035906020019064010000000081111561050b57600080fd5b82018360208201111561051d57600080fd5b8035906020019184600183028401116401000000008311171561053f57600080fd5b9091929391929390505050610d4a565b005b61061d6004803603604081101561056757600080fd5b810190808035906020019064010000000081111561058457600080fd5b82018360208201111561059657600080fd5b803590602001918460018302840111640100000000831117156105b857600080fd5b9091929391929390803590602001906401000000008111156105d957600080fd5b8201836020820111156105eb57600080fd5b8035906020019184600183028401116401000000008311171561060d57600080fd5b9091929391929390505050610f45565b005b610627612616565b61067483838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506111b8565b905080606001516000800154826040015101106106dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061280f6027913960400191505060405180910390fd5b6106e461265b565b60606106f583600001516001611341565b91509150600060020154815110610757576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b8152602001806127e4602b913960400191505060405180910390fd5b600061076b836000015185608001516108dd565b905060018081111561077957fe5b6004600083815260200190815260200160002060000160009054906101000a900460ff1660018111156107a857fe5b141561081c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f73657373696f6e2073746174652069732066696e616c697a656400000000000081525060200191505060405180910390fd5b61082b81846040015184611392565b7f84b2b939adef644951dc4dc6318dc4fbe66768898728a435c356a3296947e510816040518082815260200191505060405180910390a1505050505050565b60608060206040519080825280601f01601f1916602001820160405280156108a15781602001600182028038833980820191505090505b50905060006005600086815260200190815260200160002060000160009054906101000a900460ff169050806020830152819250505092915050565b600082826040516020018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561092d578082015181840152602081019050610912565b5050505090500193505050506040516020818303038152906040528051906020012090508160046000838152602001908152602001600020600101908051906020019061097b929190612683565b5092915050565b60006004600083815260200190815260200160002060000160009054906101000a900460ff169050919050565b6109b7612616565b610a0485858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506111b8565b9050610a0e61265b565b6060610a5f85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506001611341565b91509150610a7183608001518261141e565b6000610a808360400151611561565b9050836020015173ffffffffffffffffffffffffffffffffffffffff1684608001518260ff1681518110610ab057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415610b25576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806128366021913960400191505060405180910390fd5b6000610b39846000015186608001516108dd565b9050600180811115610b4757fe5b6004600083815260200190815260200160002060000160009054906101000a900460ff166001811115610b7657fe5b1415610bea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f73657373696f6e2073746174652069732066696e616c697a656400000000000081525060200191505060405180910390fd5b610bfd8185604001518760200151611585565b7f632769e06437be0bc831706f701d0f55babe48cb2f48113134e4103bd5830afd816040518082815260200191505060405180910390a1505050505050505050565b600080610c8f84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611611565b9050600180811115610c9d57fe5b6004600083815260200190815260200160002060000160009054906101000a900460ff166001811115610ccc57fe5b1491505092915050565b6000610ce061270d565b610d2d84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061162d565b9050610d41816000015182602001516116e1565b91505092915050565b610d52612616565b610d9f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506111b8565b9050806060015160006001015482604001510110610e08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806127bc6028913960400191505060405180910390fd5b610e1061265b565b6060610e2183600001516001611341565b91509150610e3383608001518261141e565b6000610e47836000015185608001516108dd565b9050600180811115610e5557fe5b6004600083815260200190815260200160002060000160009054906101000a900460ff166001811115610e8457fe5b1415610ef8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f73657373696f6e2073746174652069732066696e616c697a656400000000000081525060200191505060405180910390fd5b610f068184604001516117a8565b7f36a857ab2f7719bef9c1d8246bf7211e3b4ec09468b88347325456d5bec1ce3a816040518082815260200191505060405180910390a1505050505050565b610f4d612616565b610f9a85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506111b8565b9050610fa461265b565b610fb382600001516000611341565b509050610fbe61265b565b606061100f86868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506001611341565b9150915061102184608001518261141e565b61102b8284611833565b1561109e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f7261636c65206170707374617465206d75737420626520696e76616c69640081525060200191505060405180910390fd5b60006110b2836000015186608001516108dd565b90506001808111156110c057fe5b6004600083815260200190815260200160002060000160009054906101000a900460ff1660018111156110ef57fe5b1415611163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f73657373696f6e2073746174652069732066696e616c697a656400000000000081525060200191505060405180910390fd5b6111768184604001518760200151611877565b7f1ee6c3823014f5e366ff312d2cf02769f8c7767be5f8c4fc3bcfaa9eb1517d81816040518082815260200191505060405180910390a1505050505050505050565b6111c0612616565b6111c861272a565b6111d183611903565b9050600061125382600001516040516020018082805190602001908083835b6020831061121357805182526020820191506020810190506020830392506111f0565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206119ae565b90506000611265828460200151611a06565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461132a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f7369676e6572206d757374206265206f7261636c65000000000000000000000081525060200191505060405180910390fd5b6113378360000151611ae6565b9350505050919050565b61134961265b565b6060611353612744565b61135c85611d28565b905061136b8160000151611e9f565b9250831561138a57611387836040015182602001516000611f8d565b91505b509250929050565b600060046000858152602001908152602001600020905060018160000160006101000a81548160ff021916908360018111156113ca57fe5b0217905550826001815181106113dc57fe5b602001015160f81c60f81b60f81c6005600086815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555050505050565b8151815114611495576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f696e76616c6964206e756d626572206f66207369676e6572730000000000000081525060200191505060405180910390fd5b60008090505b825181101561155c578181815181106114b057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168382815181106114da57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141561154f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806128576022913960400191505060405180910390fd5b808060010191505061149b565b505050565b60008160008151811061157057fe5b602001015160f81c60f81b60f81c9050919050565b600060046000858152602001908152602001600020905060018160000160006101000a81548160ff021916908360018111156115bd57fe5b0217905550826001815181106115cf57fe5b602001015160f81c60f81b60f81c6005600086815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555050505050565b6000602082511461162157600080fd5b60208201519050919050565b61163561270d565b61163d61275e565b611646836121a4565b90506000805b611655836121d3565b156116d957611663836121e8565b8092508193505050600015611677576116d4565b600182141561169f5761169161168c8461221c565b611611565b8460000181815250506116d3565b60028214156116be576116b18361221c565b84602001819052506116d2565b6116d181846122d590919063ffffffff16565b5b5b5b61164c565b505050919050565b6000600182511461175a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207175657279206c656e67746800000000000000000000000081525060200191505060405180910390fd5b8160008151811061176757fe5b602001015160f81c60f81b60f81c60ff166005600085815260200190815260200160002060000160009054906101000a900460ff1660ff1614905092915050565b600060046000848152602001908152602001600020905060018160000160006101000a81548160ff021916908360018111156117e057fe5b0217905550816001815181106117f257fe5b602001015160f81c60f81b60f81c6005600085815260200190815260200160002060000160006101000a81548160ff021916908360ff160217905550505050565b6000816020015183602001511061184d5760009050611871565b61185f83604001518360400151612365565b61186c5760009050611871565b600190505b92915050565b600060046000858152602001908152602001600020905060018160000160006101000a81548160ff021916908360018111156118af57fe5b0217905550826001815181106118c157fe5b602001015160f81c60f81b60f81c6005600086815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555050505050565b61190b61272a565b61191361275e565b61191c836121a4565b90506000805b61192b836121d3565b156119a657611939836121e8565b809250819350505060001561194d576119a1565b600182141561196c5761195f8361221c565b84600001819052506119a0565b600282141561198b5761197e8361221c565b846020018190525061199f565b61199e81846122d590919063ffffffff16565b5b5b5b611922565b505050919050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b60006041825114611a1a5760009050611ae0565b60008060006020850151925060408501519150606085015160001a9050601b8160ff161015611a4a57601b810190505b601b8160ff1614158015611a625750601c8160ff1614155b15611a735760009350505050611ae0565b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611ad0573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b611aee612616565b611af661275e565b611aff836121a4565b90506060611b176005836124ae90919063ffffffff16565b905080600581518110611b2657fe5b6020026020010151604051908082528060200260200182016040528015611b5c5781602001602082028038833980820191505090505b508360800181905250600081600581518110611b7457fe5b6020026020010181815250506000805b611b8d846121d3565b15611d1f57611b9b846121e8565b8092508193505050600015611baf57611d1a565b6001821415611bce57611bc18461221c565b8560000181905250611d19565b6002821415611c2457611be8611be38561221c565b612553565b856020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d18565b6003821415611c4457611c3684612565565b856040018181525050611d17565b6004821415611c6457611c5684612565565b856060018181525050611d16565b6005821415611d0157611c7e611c798561221c565b612553565b856080015184600581518110611c9057fe5b602002602001015181518110611ca257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082600581518110611ce957fe5b60200260200101805180919060010181525050611d15565b611d1481856122d590919063ffffffff16565b5b5b5b5b5b5b611b84565b50505050919050565b611d30612744565b611d3861275e565b611d41836121a4565b90506060611d596002836124ae90919063ffffffff16565b905080600281518110611d6857fe5b6020026020010151604051908082528060200260200182016040528015611da357816020015b6060815260200190600190039081611d8e5790505b508360200181905250600081600281518110611dbb57fe5b6020026020010181815250506000805b611dd4846121d3565b15611e9657611de2846121e8565b8092508193505050600015611df657611e91565b6001821415611e1557611e088461221c565b8560000181905250611e90565b6002821415611e7b57611e278461221c565b856020015184600281518110611e3957fe5b602002602001015181518110611e4b57fe5b602002602001018190525082600281518110611e6357fe5b60200260200101805180919060010181525050611e8f565b611e8e81856122d590919063ffffffff16565b5b5b5b611dcb565b50505050919050565b611ea761265b565b611eaf61275e565b611eb8836121a4565b90506000805b611ec7836121d3565b15611f8557611ed5836121e8565b8092508193505050600015611ee957611f80565b6001821415611f0957611efb83612565565b846000018181525050611f7f565b6002821415611f2957611f1b83612565565b846020018181525050611f7e565b6003821415611f4857611f3b8361221c565b8460400181905250611f7d565b6004821415611f6857611f5a83612565565b846060018181525050611f7c565b611f7b81846122d590919063ffffffff16565b5b5b5b5b5b611ebe565b505050919050565b6060808351604051908082528060200260200182016040528015611fc05781602001602082028038833980820191505090505b509050600061203f866040516020018082805190602001908083835b60208310611fff5780518252602082019150602081019050602083039250611fdc565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206119ae565b9050600080905060008090505b8651811015612196576120728388838151811061206557fe5b6020026020010151611a06565b84828151811061207e57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508515612189578173ffffffffffffffffffffffffffffffffffffffff168482815181106120e157fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1611612172576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f7369676e657273206e6f7420696e20617363656e64696e67206f72646572000081525060200191505060405180910390fd5b83818151811061217e57fe5b602002602001015191505b808060010191505061204c565b508293505050509392505050565b6121ac61275e565b60018251116121ba57600080fd5b8181602001819052506000816000018181525050919050565b60008160200151518260000151109050919050565b60008060006121f684612565565b90506008818161220257fe5b04925060078116600581111561221457fe5b915050915091565b6060600061222983612565565b9050600081846000015101905083602001515181111561224857600080fd5b816040519080825280601f01601f19166020018201604052801561227b5781602001600182028038833980820191505090505b50925060608460200151905060008086600001519050602086019150806020840101905060008090505b858110156122c05780820151818401526020810190506122a5565b50838760000181815250505050505050919050565b600060058111156122e257fe5b8160058111156122ee57fe5b1415612303576122fd82612565565b50612361565b6002600581111561231057fe5b81600581111561231c57fe5b141561235b57600061232d83612565565b9050808360000181815101915081815250508260200151518360000151111561235557600080fd5b50612360565b600080fd5b5b5050565b600060028351146123de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f696e76616c696420636f7369676e6564207374617465206c656e67746800000081525060200191505060405180910390fd5b60028251146123f057600090506124a8565b60006123fb84611561565b9050600061240884611561565b90508060ff166000600201546001840160ff168161242257fe5b0614612433576000925050506124a8565b60008560018151811061244257fe5b602001015160f81c60f81b60f81c905060008560018151811061246157fe5b602001015160f81c60f81b60f81c905060018260ff161480612486575060028260ff16145b1561249f578060ff168260ff16149450505050506124a8565b60019450505050505b92915050565b6060600083600001519050600183016040519080825280602002602001820160405280156124eb5781602001602082028038833980820191505090505b5091506000805b6124fb866121d3565b1561254057612509866121e8565b8092508193505050600184838151811061251f57fe5b60200260200101818151019150818152505061253b86826122d5565b6124f2565b8286600001818152505050505092915050565b600061255e826125eb565b9050919050565b60008060608360200151905083600001519250826020820101519150600080935060008090505b600a8110156125e05783811a915060078102607f8316901b8517945060006080831614156125d35760018101866000018181510191508181525050849450505050506125e6565b808060010191505061258c565b50600080fd5b919050565b600060148251146125fb57600080fd5b6c010000000000000000000000006020830151049050919050565b6040518060a0016040528060608152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001606081525090565b6040518060800160405280600081526020016000815260200160608152602001600081525090565b8280548282559060005260206000209081019282156126fc579160200282015b828111156126fb5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906126a3565b5b5090506127099190612778565b5090565b604051806040016040528060008019168152602001606081525090565b604051806040016040528060608152602001606081525090565b604051806040016040528060608152602001606081525090565b604051806040016040528060008152602001606081525090565b6127b891905b808211156127b457600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010161277e565b5090565b9056fe6f7261636c65207374617465206d757374206265206166746572206d6f766520646561646c696e657369676e657273206c656e677468206d75737420626520736d616c6c6572207468616e20706c61796572736f7261636c65207374617465206d7573742062652061667465722073696720646561646c696e656f7261636c652073746174652075736572206d75737420626520696e76616c696473746174652070726f6f66207369676e6572206d75737420626520636f7272656374a165627a7a723058201ab16154d991b9c54c098110451f96315db33346e5465caa26ea9a86c0e147e50029", -} - -// SimpleMultiSessionAppWithOracleABI is the input ABI used to generate the binding from. -// Deprecated: Use SimpleMultiSessionAppWithOracleMetaData.ABI instead. -var SimpleMultiSessionAppWithOracleABI = SimpleMultiSessionAppWithOracleMetaData.ABI - -// SimpleMultiSessionAppWithOracleBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use SimpleMultiSessionAppWithOracleMetaData.Bin instead. -var SimpleMultiSessionAppWithOracleBin = SimpleMultiSessionAppWithOracleMetaData.Bin - -// DeploySimpleMultiSessionAppWithOracle deploys a new Ethereum contract, binding an instance of SimpleMultiSessionAppWithOracle to it. -func DeploySimpleMultiSessionAppWithOracle(auth *bind.TransactOpts, backend bind.ContractBackend, _sigTimeout *big.Int, _moveTimeout *big.Int, _playerNum *big.Int, _oracle common.Address) (common.Address, *types.Transaction, *SimpleMultiSessionAppWithOracle, error) { - parsed, err := SimpleMultiSessionAppWithOracleMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SimpleMultiSessionAppWithOracleBin), backend, _sigTimeout, _moveTimeout, _playerNum, _oracle) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SimpleMultiSessionAppWithOracle{SimpleMultiSessionAppWithOracleCaller: SimpleMultiSessionAppWithOracleCaller{contract: contract}, SimpleMultiSessionAppWithOracleTransactor: SimpleMultiSessionAppWithOracleTransactor{contract: contract}, SimpleMultiSessionAppWithOracleFilterer: SimpleMultiSessionAppWithOracleFilterer{contract: contract}}, nil -} - -// SimpleMultiSessionAppWithOracle is an auto generated Go binding around an Ethereum contract. -type SimpleMultiSessionAppWithOracle struct { - SimpleMultiSessionAppWithOracleCaller // Read-only binding to the contract - SimpleMultiSessionAppWithOracleTransactor // Write-only binding to the contract - SimpleMultiSessionAppWithOracleFilterer // Log filterer for contract events -} - -// SimpleMultiSessionAppWithOracleCaller is an auto generated read-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppWithOracleCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleMultiSessionAppWithOracleTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppWithOracleTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleMultiSessionAppWithOracleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SimpleMultiSessionAppWithOracleFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleMultiSessionAppWithOracleSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SimpleMultiSessionAppWithOracleSession struct { - Contract *SimpleMultiSessionAppWithOracle // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleMultiSessionAppWithOracleCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SimpleMultiSessionAppWithOracleCallerSession struct { - Contract *SimpleMultiSessionAppWithOracleCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SimpleMultiSessionAppWithOracleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SimpleMultiSessionAppWithOracleTransactorSession struct { - Contract *SimpleMultiSessionAppWithOracleTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleMultiSessionAppWithOracleRaw is an auto generated low-level Go binding around an Ethereum contract. -type SimpleMultiSessionAppWithOracleRaw struct { - Contract *SimpleMultiSessionAppWithOracle // Generic contract binding to access the raw methods on -} - -// SimpleMultiSessionAppWithOracleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppWithOracleCallerRaw struct { - Contract *SimpleMultiSessionAppWithOracleCaller // Generic read-only contract binding to access the raw methods on -} - -// SimpleMultiSessionAppWithOracleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SimpleMultiSessionAppWithOracleTransactorRaw struct { - Contract *SimpleMultiSessionAppWithOracleTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSimpleMultiSessionAppWithOracle creates a new instance of SimpleMultiSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleMultiSessionAppWithOracle(address common.Address, backend bind.ContractBackend) (*SimpleMultiSessionAppWithOracle, error) { - contract, err := bindSimpleMultiSessionAppWithOracle(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracle{SimpleMultiSessionAppWithOracleCaller: SimpleMultiSessionAppWithOracleCaller{contract: contract}, SimpleMultiSessionAppWithOracleTransactor: SimpleMultiSessionAppWithOracleTransactor{contract: contract}, SimpleMultiSessionAppWithOracleFilterer: SimpleMultiSessionAppWithOracleFilterer{contract: contract}}, nil -} - -// NewSimpleMultiSessionAppWithOracleCaller creates a new read-only instance of SimpleMultiSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleMultiSessionAppWithOracleCaller(address common.Address, caller bind.ContractCaller) (*SimpleMultiSessionAppWithOracleCaller, error) { - contract, err := bindSimpleMultiSessionAppWithOracle(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleCaller{contract: contract}, nil -} - -// NewSimpleMultiSessionAppWithOracleTransactor creates a new write-only instance of SimpleMultiSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleMultiSessionAppWithOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*SimpleMultiSessionAppWithOracleTransactor, error) { - contract, err := bindSimpleMultiSessionAppWithOracle(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleTransactor{contract: contract}, nil -} - -// NewSimpleMultiSessionAppWithOracleFilterer creates a new log filterer instance of SimpleMultiSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleMultiSessionAppWithOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*SimpleMultiSessionAppWithOracleFilterer, error) { - contract, err := bindSimpleMultiSessionAppWithOracle(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleFilterer{contract: contract}, nil -} - -// bindSimpleMultiSessionAppWithOracle binds a generic wrapper to an already deployed contract. -func bindSimpleMultiSessionAppWithOracle(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SimpleMultiSessionAppWithOracleMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleMultiSessionAppWithOracle.Contract.SimpleMultiSessionAppWithOracleCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SimpleMultiSessionAppWithOracleTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SimpleMultiSessionAppWithOracleTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleMultiSessionAppWithOracle.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.contract.Transact(opts, method, params...) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleMultiSessionAppWithOracle.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetOutcome(&_SimpleMultiSessionAppWithOracle.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCallerSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetOutcome(&_SimpleMultiSessionAppWithOracle.CallOpts, _query) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCaller) GetState(opts *bind.CallOpts, _session [32]byte, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _SimpleMultiSessionAppWithOracle.contract.Call(opts, &out, "getState", _session, _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetState(&_SimpleMultiSessionAppWithOracle.CallOpts, _session, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x29dd2f8e. -// -// Solidity: function getState(bytes32 _session, uint256 _key) view returns(bytes) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCallerSession) GetState(_session [32]byte, _key *big.Int) ([]byte, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetState(&_SimpleMultiSessionAppWithOracle.CallOpts, _session, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCaller) GetStatus(opts *bind.CallOpts, _session [32]byte) (uint8, error) { - var out []interface{} - err := _SimpleMultiSessionAppWithOracle.contract.Call(opts, &out, "getStatus", _session) - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) GetStatus(_session [32]byte) (uint8, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetStatus(&_SimpleMultiSessionAppWithOracle.CallOpts, _session) -} - -// GetStatus is a free data retrieval call binding the contract method 0x5de28ae0. -// -// Solidity: function getStatus(bytes32 _session) view returns(uint8) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCallerSession) GetStatus(_session [32]byte) (uint8, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetStatus(&_SimpleMultiSessionAppWithOracle.CallOpts, _session) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleMultiSessionAppWithOracle.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleMultiSessionAppWithOracle.Contract.IsFinalized(&_SimpleMultiSessionAppWithOracle.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleCallerSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleMultiSessionAppWithOracle.Contract.IsFinalized(&_SimpleMultiSessionAppWithOracle.CallOpts, _query) -} - -// GetSessionID is a paid mutator transaction binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) returns(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactor) GetSessionID(opts *bind.TransactOpts, _nonce *big.Int, _signers []common.Address) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.contract.Transact(opts, "getSessionID", _nonce, _signers) -} - -// GetSessionID is a paid mutator transaction binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) returns(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) GetSessionID(_nonce *big.Int, _signers []common.Address) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetSessionID(&_SimpleMultiSessionAppWithOracle.TransactOpts, _nonce, _signers) -} - -// GetSessionID is a paid mutator transaction binding the contract method 0x4d8bedec. -// -// Solidity: function getSessionID(uint256 _nonce, address[] _signers) returns(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorSession) GetSessionID(_nonce *big.Int, _signers []common.Address) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.GetSessionID(&_SimpleMultiSessionAppWithOracle.TransactOpts, _nonce, _signers) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactor) SettleByInvalidState(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.contract.Transact(opts, "settleByInvalidState", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleByInvalidState(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleByInvalidState(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactor) SettleByInvalidTurn(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.contract.Transact(opts, "settleByInvalidTurn", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleByInvalidTurn(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleByInvalidTurn(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactor) SettleByMoveTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.contract.Transact(opts, "settleByMoveTimeout", _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleByMoveTimeout(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleByMoveTimeout(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactor) SettleBySigTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.contract.Transact(opts, "settleBySigTimeout", _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleBySigTimeout(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleTransactorSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleMultiSessionAppWithOracle.Contract.SettleBySigTimeout(&_SimpleMultiSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator is returned from FilterInvalidStateDispute and is used to iterate over the raw logs and unpacked data for InvalidStateDispute events raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator struct { - Event *SimpleMultiSessionAppWithOracleInvalidStateDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleInvalidStateDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleInvalidStateDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleMultiSessionAppWithOracleInvalidStateDispute represents a InvalidStateDispute event raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleInvalidStateDispute struct { - Session [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInvalidStateDispute is a free log retrieval operation binding the contract event 0x1ee6c3823014f5e366ff312d2cf02769f8c7767be5f8c4fc3bcfaa9eb1517d81. -// -// Solidity: event InvalidStateDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) FilterInvalidStateDispute(opts *bind.FilterOpts) (*SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.FilterLogs(opts, "InvalidStateDispute") - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleInvalidStateDisputeIterator{contract: _SimpleMultiSessionAppWithOracle.contract, event: "InvalidStateDispute", logs: logs, sub: sub}, nil -} - -// WatchInvalidStateDispute is a free log subscription operation binding the contract event 0x1ee6c3823014f5e366ff312d2cf02769f8c7767be5f8c4fc3bcfaa9eb1517d81. -// -// Solidity: event InvalidStateDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) WatchInvalidStateDispute(opts *bind.WatchOpts, sink chan<- *SimpleMultiSessionAppWithOracleInvalidStateDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.WatchLogs(opts, "InvalidStateDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleMultiSessionAppWithOracleInvalidStateDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "InvalidStateDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInvalidStateDispute is a log parse operation binding the contract event 0x1ee6c3823014f5e366ff312d2cf02769f8c7767be5f8c4fc3bcfaa9eb1517d81. -// -// Solidity: event InvalidStateDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) ParseInvalidStateDispute(log types.Log) (*SimpleMultiSessionAppWithOracleInvalidStateDispute, error) { - event := new(SimpleMultiSessionAppWithOracleInvalidStateDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "InvalidStateDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator is returned from FilterInvalidTurnDispute and is used to iterate over the raw logs and unpacked data for InvalidTurnDispute events raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator struct { - Event *SimpleMultiSessionAppWithOracleInvalidTurnDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleInvalidTurnDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleInvalidTurnDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleMultiSessionAppWithOracleInvalidTurnDispute represents a InvalidTurnDispute event raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleInvalidTurnDispute struct { - Session [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInvalidTurnDispute is a free log retrieval operation binding the contract event 0x632769e06437be0bc831706f701d0f55babe48cb2f48113134e4103bd5830afd. -// -// Solidity: event InvalidTurnDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) FilterInvalidTurnDispute(opts *bind.FilterOpts) (*SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.FilterLogs(opts, "InvalidTurnDispute") - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleInvalidTurnDisputeIterator{contract: _SimpleMultiSessionAppWithOracle.contract, event: "InvalidTurnDispute", logs: logs, sub: sub}, nil -} - -// WatchInvalidTurnDispute is a free log subscription operation binding the contract event 0x632769e06437be0bc831706f701d0f55babe48cb2f48113134e4103bd5830afd. -// -// Solidity: event InvalidTurnDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) WatchInvalidTurnDispute(opts *bind.WatchOpts, sink chan<- *SimpleMultiSessionAppWithOracleInvalidTurnDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.WatchLogs(opts, "InvalidTurnDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleMultiSessionAppWithOracleInvalidTurnDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "InvalidTurnDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInvalidTurnDispute is a log parse operation binding the contract event 0x632769e06437be0bc831706f701d0f55babe48cb2f48113134e4103bd5830afd. -// -// Solidity: event InvalidTurnDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) ParseInvalidTurnDispute(log types.Log) (*SimpleMultiSessionAppWithOracleInvalidTurnDispute, error) { - event := new(SimpleMultiSessionAppWithOracleInvalidTurnDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "InvalidTurnDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator is returned from FilterMoveTimeoutDispute and is used to iterate over the raw logs and unpacked data for MoveTimeoutDispute events raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator struct { - Event *SimpleMultiSessionAppWithOracleMoveTimeoutDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleMoveTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleMoveTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleMultiSessionAppWithOracleMoveTimeoutDispute represents a MoveTimeoutDispute event raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleMoveTimeoutDispute struct { - Session [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMoveTimeoutDispute is a free log retrieval operation binding the contract event 0x36a857ab2f7719bef9c1d8246bf7211e3b4ec09468b88347325456d5bec1ce3a. -// -// Solidity: event MoveTimeoutDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) FilterMoveTimeoutDispute(opts *bind.FilterOpts) (*SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.FilterLogs(opts, "MoveTimeoutDispute") - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleMoveTimeoutDisputeIterator{contract: _SimpleMultiSessionAppWithOracle.contract, event: "MoveTimeoutDispute", logs: logs, sub: sub}, nil -} - -// WatchMoveTimeoutDispute is a free log subscription operation binding the contract event 0x36a857ab2f7719bef9c1d8246bf7211e3b4ec09468b88347325456d5bec1ce3a. -// -// Solidity: event MoveTimeoutDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) WatchMoveTimeoutDispute(opts *bind.WatchOpts, sink chan<- *SimpleMultiSessionAppWithOracleMoveTimeoutDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.WatchLogs(opts, "MoveTimeoutDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleMultiSessionAppWithOracleMoveTimeoutDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "MoveTimeoutDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMoveTimeoutDispute is a log parse operation binding the contract event 0x36a857ab2f7719bef9c1d8246bf7211e3b4ec09468b88347325456d5bec1ce3a. -// -// Solidity: event MoveTimeoutDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) ParseMoveTimeoutDispute(log types.Log) (*SimpleMultiSessionAppWithOracleMoveTimeoutDispute, error) { - event := new(SimpleMultiSessionAppWithOracleMoveTimeoutDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "MoveTimeoutDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator is returned from FilterSigTimeoutDispute and is used to iterate over the raw logs and unpacked data for SigTimeoutDispute events raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator struct { - Event *SimpleMultiSessionAppWithOracleSigTimeoutDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleSigTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleMultiSessionAppWithOracleSigTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleMultiSessionAppWithOracleSigTimeoutDispute represents a SigTimeoutDispute event raised by the SimpleMultiSessionAppWithOracle contract. -type SimpleMultiSessionAppWithOracleSigTimeoutDispute struct { - Session [32]byte - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSigTimeoutDispute is a free log retrieval operation binding the contract event 0x84b2b939adef644951dc4dc6318dc4fbe66768898728a435c356a3296947e510. -// -// Solidity: event SigTimeoutDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) FilterSigTimeoutDispute(opts *bind.FilterOpts) (*SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.FilterLogs(opts, "SigTimeoutDispute") - if err != nil { - return nil, err - } - return &SimpleMultiSessionAppWithOracleSigTimeoutDisputeIterator{contract: _SimpleMultiSessionAppWithOracle.contract, event: "SigTimeoutDispute", logs: logs, sub: sub}, nil -} - -// WatchSigTimeoutDispute is a free log subscription operation binding the contract event 0x84b2b939adef644951dc4dc6318dc4fbe66768898728a435c356a3296947e510. -// -// Solidity: event SigTimeoutDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) WatchSigTimeoutDispute(opts *bind.WatchOpts, sink chan<- *SimpleMultiSessionAppWithOracleSigTimeoutDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleMultiSessionAppWithOracle.contract.WatchLogs(opts, "SigTimeoutDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleMultiSessionAppWithOracleSigTimeoutDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "SigTimeoutDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSigTimeoutDispute is a log parse operation binding the contract event 0x84b2b939adef644951dc4dc6318dc4fbe66768898728a435c356a3296947e510. -// -// Solidity: event SigTimeoutDispute(bytes32 session) -func (_SimpleMultiSessionAppWithOracle *SimpleMultiSessionAppWithOracleFilterer) ParseSigTimeoutDispute(log types.Log) (*SimpleMultiSessionAppWithOracleSigTimeoutDispute, error) { - event := new(SimpleMultiSessionAppWithOracleSigTimeoutDispute) - if err := _SimpleMultiSessionAppWithOracle.contract.UnpackLog(event, "SigTimeoutDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/testing/testapp/singlesessionapp.go b/testing/testapp/singlesessionapp.go deleted file mode 100644 index 32740e7..0000000 --- a/testing/testapp/singlesessionapp.go +++ /dev/null @@ -1,617 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package testapp - -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" -) - -// 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 -) - -// SimpleSingleSessionAppMetaData contains all meta data concerning the SimpleSingleSessionApp contract. -var SimpleSingleSessionAppMetaData = &bind.MetaData{ - ABI: "[{\"constant\":false,\"inputs\":[{\"name\":\"_stateProof\",\"type\":\"bytes\"}],\"name\":\"intendSettle\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_action\",\"type\":\"bytes\"}],\"name\":\"applyAction\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSeqNum\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSettleFinalizedTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getActionDeadline\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"finalizeOnActionTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_players\",\"type\":\"address[]\"},{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_timeout\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"seq\",\"type\":\"uint256\"}],\"name\":\"IntendSettle\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b5060405162001b6238038062001b62833981018060405260608110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b828101905060208101848111156200006757600080fd5b81518560208202830111640100000000821117156200008557600080fd5b505092919060200180519060200190929190805190602001909291905050508282828282828160008001819055508260006001019080519060200190620000ce92919062000119565b50806000600301819055506000806002018190555060008060050160006101000a81548160ff021916908360038111156200010557fe5b0217905550505050505050505050620001ee565b82805482825590600052602060002090810192821562000195579160200282015b82811115620001945782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906200013a565b5b509050620001a49190620001a8565b5090565b620001eb91905b80821115620001e757600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101620001af565b5090565b90565b61196480620001fe6000396000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c8063b71ca01f11610066578063b71ca01f14610286578063bbc35280146102a4578063bcdbda94146102c2578063ea4ba8eb14610353578063fa5e7ff5146103e45761009e565b8063130d33fe146100a35780631f2b71e51461011c57806344c9af28146101955780634e69d5601461023c5780636d15c45714610268575b600080fd5b61011a600480360360208110156100b957600080fd5b81019080803590602001906401000000008111156100d657600080fd5b8201836020820111156100e857600080fd5b8035906020019184600183028401116401000000008311171561010a57600080fd5b90919293919293905050506103ee565b005b6101936004803603602081101561013257600080fd5b810190808035906020019064010000000081111561014f57600080fd5b82018360208201111561016157600080fd5b8035906020019184600183028401116401000000008311171561018357600080fd5b9091929391929390505050610780565b005b6101c1600480360360208110156101ab57600080fd5b81019080803590602001909291905050506109a5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102015780820151818401526020810190506101e6565b50505050905090810190601f16801561022e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610244610a03565b6040518082600381111561025457fe5b60ff16815260200191505060405180910390f35b610270610a1c565b6040518082815260200191505060405180910390f35b61028e610a28565b6040518082815260200191505060405180910390f35b6102ac610a70565b6040518082815260200191505060405180910390f35b610339600480360360208110156102d857600080fd5b81019080803590602001906401000000008111156102f557600080fd5b82018360208201111561030757600080fd5b8035906020019184600183028401116401000000008311171561032957600080fd5b9091929391929390505050610afd565b604051808215151515815260200191505060405180910390f35b6103ca6004803603602081101561036957600080fd5b810190808035906020019064010000000081111561038657600080fd5b82018360208201111561039857600080fd5b803590602001918460018302840111640100000000831117156103ba57600080fd5b9091929391929390505050610b41565b604051808215151515815260200191505060405180910390f35b6103ec610bf5565b005b6003808111156103fa57fe5b600060050160009054906101000a900460ff16600381111561041857fe5b141561048c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b6104946118dc565b6104e183838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610c9b565b90506104f581600001518260200151610e12565b610567576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f696e76616c6964207369676e617475726500000000000000000000000000000081525060200191505060405180910390fd5b61056f6118f6565b61057c8260000151610f5c565b905060008001548160000151146105fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f6e6f6e6365206e6f74206d61746368000000000000000000000000000000000081525060200191505060405180910390fd5b806020015160006002015410610679576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f696e76616c69642073657175656e6365206e756d62657200000000000000000081525060200191505060405180910390fd5b80602001516000600201819055506001600060050160006101000a81548160ff021916908360038111156106a957fe5b021790555060006003015443016000600401819055506106cc816040015161104a565b61073e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f737461746520757064617465206661696c65640000000000000000000000000081525060200191505060405180910390fd5b7fce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a6000600201546040518082815260200191505060405180910390a150505050565b60038081111561078c57fe5b600060050160009054906101000a900460ff1660038111156107aa57fe5b141561081e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b6001600381111561082b57fe5b600060050160009054906101000a900460ff16600381111561084957fe5b14801561085a575060006004015443115b15610887576002600060050160006101000a81548160ff0219169083600381111561088157fe5b02179055505b6002600381111561089457fe5b600060050160009054906101000a900460ff1660038111156108b257fe5b14610925576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f617070206e6f7420696e20616374696f6e206d6f64650000000000000000000081525060200191505060405180910390fd5b600060020160008154809291906001019190505550600060030154430160006004018190555061099882828080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611161565b6109a157600080fd5b5050565b60608060206040519080825280601f01601f1916602001820160405280156109dc5781602001600182028038833980820191505090505b5090506000600660009054906101000a900460ff1690508060208301528192505050919050565b60008060050160009054906101000a900460ff16905090565b60008060020154905090565b600060016003811115610a3757fe5b600060050160009054906101000a900460ff166003811115610a5557fe5b1415610a68576000600401549050610a6d565b600090505b90565b600060026003811115610a7f57fe5b600060050160009054906101000a900460ff166003811115610a9d57fe5b1415610ab0576000600401549050610afa565b60016003811115610abd57fe5b600060050160009054906101000a900460ff166003811115610adb57fe5b1415610af557600060030154600060040154019050610afa565b600090505b90565b6000808383905014610b0e57600080fd5b600380811115610b1a57fe5b600060050160009054906101000a900460ff166003811115610b3857fe5b14905092915050565b600060018383905014610bbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207175657279206c656e67746800000000000000000000000081525060200191505060405180910390fd5b82826000818110610bc957fe5b9050013560f81c60f81b60f81c60ff16600660009054906101000a900460ff1660ff1614905092915050565b60026003811115610c0257fe5b600060050160009054906101000a900460ff166003811115610c2057fe5b1415610c3c576000600401544311610c3757600080fd5b610c90565b60016003811115610c4957fe5b600060050160009054906101000a900460ff166003811115610c6757fe5b1415610c8a57600060030154600060040154014311610c8557600080fd5b610c8f565b610c99565b5b610c98611278565b5b565b610ca36118dc565b610cab61191e565b610cb4836112a1565b90506060610ccc6002836112d090919063ffffffff16565b905080600281518110610cdb57fe5b6020026020010151604051908082528060200260200182016040528015610d1657816020015b6060815260200190600190039081610d015790505b508360200181905250600081600281518110610d2e57fe5b6020026020010181815250506000805b610d4784611375565b15610e0957610d558461138a565b8092508193505050600015610d6957610e04565b6001821415610d8857610d7b846113be565b8560000181905250610e03565b6002821415610dee57610d9a846113be565b856020015184600281518110610dac57fe5b602002602001015181518110610dbe57fe5b602002602001018190525082600281518110610dd657fe5b60200260200101805180919060010181525050610e02565b610e01818561147790919063ffffffff16565b5b5b5b610d3e565b50505050919050565b60008060010180549050825114610e91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f696e76616c6964206e756d626572206f66207369676e6174757265730000000081525060200191505060405180910390fd5b6060610e9f84846000611507565b905060008090505b600060010180549050811015610f4f57818181518110610ec357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1660006001018281548110610ef157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f4257600092505050610f56565b8080600101915050610ea7565b5060019150505b92915050565b610f646118f6565b610f6c61191e565b610f75836112a1565b90506000805b610f8483611375565b1561104257610f928361138a565b8092508193505050600015610fa65761103d565b6001821415610fc657610fb88361171e565b84600001818152505061103c565b6002821415610fe657610fd88361171e565b84602001818152505061103b565b600382141561100557610ff8836113be565b846040018190525061103a565b6004821415611025576110178361171e565b846060018181525050611039565b611038818461147790919063ffffffff16565b5b5b5b5b5b610f7b565b505050919050565b600060018251146110c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207374617465206c656e67746800000000000000000000000081525060200191505060405180910390fd5b816000815181106110d057fe5b602001015160f81c60f81b60f81c600660006101000a81548160ff021916908360ff1602179055506001600660009054906101000a900460ff1660ff16148061112b57506002600660009054906101000a900460ff1660ff16145b15611158576003600060050160006101000a81548160ff0219169083600381111561115257fe5b02179055505b60019050919050565b600060018251146111da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f696e76616c696420616374696f6e206c656e677468000000000000000000000081525060200191505060405180910390fd5b816000815181106111e757fe5b602001015160f81c60f81b60f81c600660006101000a81548160ff021916908360ff1602179055506001600660009054906101000a900460ff1660ff16148061124257506002600660009054906101000a900460ff1660ff16145b1561126f576003600060050160006101000a81548160ff0219169083600381111561126957fe5b02179055505b60019050919050565b6003600060050160006101000a81548160ff0219169083600381111561129a57fe5b0217905550565b6112a961191e565b60018251116112b757600080fd5b8181602001819052506000816000018181525050919050565b60606000836000015190506001830160405190808252806020026020018201604052801561130d5781602001602082028038833980820191505090505b5091506000805b61131d86611375565b156113625761132b8661138a565b8092508193505050600184838151811061134157fe5b60200260200101818151019150818152505061135d8682611477565b611314565b8286600001818152505050505092915050565b60008160200151518260000151109050919050565b60008060006113988461171e565b9050600881816113a457fe5b0492506007811660058111156113b657fe5b915050915091565b606060006113cb8361171e565b905060008184600001510190508360200151518111156113ea57600080fd5b816040519080825280601f01601f19166020018201604052801561141d5781602001600182028038833980820191505090505b50925060608460200151905060008086600001519050602086019150806020840101905060008090505b85811015611462578082015181840152602081019050611447565b50838760000181815250505050505050919050565b6000600581111561148457fe5b81600581111561149057fe5b14156114a55761149f8261171e565b50611503565b600260058111156114b257fe5b8160058111156114be57fe5b14156114fd5760006114cf8361171e565b905080836000018181510191508181525050826020015151836000015111156114f757600080fd5b50611502565b600080fd5b5b5050565b606080835160405190808252806020026020018201604052801561153a5781602001602082028038833980820191505090505b50905060006115b9866040516020018082805190602001908083835b602083106115795780518252602082019150602081019050602083039250611556565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206117a4565b9050600080905060008090505b8651811015611710576115ec838883815181106115df57fe5b60200260200101516117fc565b8482815181106115f857fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508515611703578173ffffffffffffffffffffffffffffffffffffffff1684828151811061165b57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16116116ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f7369676e657273206e6f7420696e20617363656e64696e67206f72646572000081525060200191505060405180910390fd5b8381815181106116f857fe5b602002602001015191505b80806001019150506115c6565b508293505050509392505050565b60008060608360200151905083600001519250826020820101519150600080935060008090505b600a8110156117995783811a915060078102607f8316901b85179450600060808316141561178c57600181018660000181815101915081815250508494505050505061179f565b8080600101915050611745565b50600080fd5b919050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b6000604182511461181057600090506118d6565b60008060006020850151925060408501519150606085015160001a9050601b8160ff16101561184057601b810190505b601b8160ff16141580156118585750601c8160ff1614155b1561186957600093505050506118d6565b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa1580156118c6573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b604051806040016040528060608152602001606081525090565b6040518060800160405280600081526020016000815260200160608152602001600081525090565b60405180604001604052806000815260200160608152509056fea165627a7a723058202cff3ccecd57e354a68effd0ab29670d09f8325852c811d185e3f6dfcef547310029", -} - -// SimpleSingleSessionAppABI is the input ABI used to generate the binding from. -// Deprecated: Use SimpleSingleSessionAppMetaData.ABI instead. -var SimpleSingleSessionAppABI = SimpleSingleSessionAppMetaData.ABI - -// SimpleSingleSessionAppBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use SimpleSingleSessionAppMetaData.Bin instead. -var SimpleSingleSessionAppBin = SimpleSingleSessionAppMetaData.Bin - -// DeploySimpleSingleSessionApp deploys a new Ethereum contract, binding an instance of SimpleSingleSessionApp to it. -func DeploySimpleSingleSessionApp(auth *bind.TransactOpts, backend bind.ContractBackend, _players []common.Address, _nonce *big.Int, _timeout *big.Int) (common.Address, *types.Transaction, *SimpleSingleSessionApp, error) { - parsed, err := SimpleSingleSessionAppMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SimpleSingleSessionAppBin), backend, _players, _nonce, _timeout) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SimpleSingleSessionApp{SimpleSingleSessionAppCaller: SimpleSingleSessionAppCaller{contract: contract}, SimpleSingleSessionAppTransactor: SimpleSingleSessionAppTransactor{contract: contract}, SimpleSingleSessionAppFilterer: SimpleSingleSessionAppFilterer{contract: contract}}, nil -} - -// SimpleSingleSessionApp is an auto generated Go binding around an Ethereum contract. -type SimpleSingleSessionApp struct { - SimpleSingleSessionAppCaller // Read-only binding to the contract - SimpleSingleSessionAppTransactor // Write-only binding to the contract - SimpleSingleSessionAppFilterer // Log filterer for contract events -} - -// SimpleSingleSessionAppCaller is an auto generated read-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleSingleSessionAppTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleSingleSessionAppFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SimpleSingleSessionAppFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleSingleSessionAppSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SimpleSingleSessionAppSession struct { - Contract *SimpleSingleSessionApp // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleSingleSessionAppCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SimpleSingleSessionAppCallerSession struct { - Contract *SimpleSingleSessionAppCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SimpleSingleSessionAppTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SimpleSingleSessionAppTransactorSession struct { - Contract *SimpleSingleSessionAppTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleSingleSessionAppRaw is an auto generated low-level Go binding around an Ethereum contract. -type SimpleSingleSessionAppRaw struct { - Contract *SimpleSingleSessionApp // Generic contract binding to access the raw methods on -} - -// SimpleSingleSessionAppCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppCallerRaw struct { - Contract *SimpleSingleSessionAppCaller // Generic read-only contract binding to access the raw methods on -} - -// SimpleSingleSessionAppTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppTransactorRaw struct { - Contract *SimpleSingleSessionAppTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSimpleSingleSessionApp creates a new instance of SimpleSingleSessionApp, bound to a specific deployed contract. -func NewSimpleSingleSessionApp(address common.Address, backend bind.ContractBackend) (*SimpleSingleSessionApp, error) { - contract, err := bindSimpleSingleSessionApp(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SimpleSingleSessionApp{SimpleSingleSessionAppCaller: SimpleSingleSessionAppCaller{contract: contract}, SimpleSingleSessionAppTransactor: SimpleSingleSessionAppTransactor{contract: contract}, SimpleSingleSessionAppFilterer: SimpleSingleSessionAppFilterer{contract: contract}}, nil -} - -// NewSimpleSingleSessionAppCaller creates a new read-only instance of SimpleSingleSessionApp, bound to a specific deployed contract. -func NewSimpleSingleSessionAppCaller(address common.Address, caller bind.ContractCaller) (*SimpleSingleSessionAppCaller, error) { - contract, err := bindSimpleSingleSessionApp(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppCaller{contract: contract}, nil -} - -// NewSimpleSingleSessionAppTransactor creates a new write-only instance of SimpleSingleSessionApp, bound to a specific deployed contract. -func NewSimpleSingleSessionAppTransactor(address common.Address, transactor bind.ContractTransactor) (*SimpleSingleSessionAppTransactor, error) { - contract, err := bindSimpleSingleSessionApp(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppTransactor{contract: contract}, nil -} - -// NewSimpleSingleSessionAppFilterer creates a new log filterer instance of SimpleSingleSessionApp, bound to a specific deployed contract. -func NewSimpleSingleSessionAppFilterer(address common.Address, filterer bind.ContractFilterer) (*SimpleSingleSessionAppFilterer, error) { - contract, err := bindSimpleSingleSessionApp(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppFilterer{contract: contract}, nil -} - -// bindSimpleSingleSessionApp binds a generic wrapper to an already deployed contract. -func bindSimpleSingleSessionApp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SimpleSingleSessionAppMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleSingleSessionApp *SimpleSingleSessionAppRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleSingleSessionApp.Contract.SimpleSingleSessionAppCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleSingleSessionApp *SimpleSingleSessionAppRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.SimpleSingleSessionAppTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleSingleSessionApp *SimpleSingleSessionAppRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.SimpleSingleSessionAppTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleSingleSessionApp.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.contract.Transact(opts, method, params...) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xbbc35280. -// -// Solidity: function getActionDeadline() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) GetActionDeadline(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "getActionDeadline") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xbbc35280. -// -// Solidity: function getActionDeadline() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) GetActionDeadline() (*big.Int, error) { - return _SimpleSingleSessionApp.Contract.GetActionDeadline(&_SimpleSingleSessionApp.CallOpts) -} - -// GetActionDeadline is a free data retrieval call binding the contract method 0xbbc35280. -// -// Solidity: function getActionDeadline() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) GetActionDeadline() (*big.Int, error) { - return _SimpleSingleSessionApp.Contract.GetActionDeadline(&_SimpleSingleSessionApp.CallOpts) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleSingleSessionApp.Contract.GetOutcome(&_SimpleSingleSessionApp.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleSingleSessionApp.Contract.GetOutcome(&_SimpleSingleSessionApp.CallOpts, _query) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x6d15c457. -// -// Solidity: function getSeqNum() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) GetSeqNum(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "getSeqNum") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x6d15c457. -// -// Solidity: function getSeqNum() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) GetSeqNum() (*big.Int, error) { - return _SimpleSingleSessionApp.Contract.GetSeqNum(&_SimpleSingleSessionApp.CallOpts) -} - -// GetSeqNum is a free data retrieval call binding the contract method 0x6d15c457. -// -// Solidity: function getSeqNum() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) GetSeqNum() (*big.Int, error) { - return _SimpleSingleSessionApp.Contract.GetSeqNum(&_SimpleSingleSessionApp.CallOpts) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0xb71ca01f. -// -// Solidity: function getSettleFinalizedTime() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) GetSettleFinalizedTime(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "getSettleFinalizedTime") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0xb71ca01f. -// -// Solidity: function getSettleFinalizedTime() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) GetSettleFinalizedTime() (*big.Int, error) { - return _SimpleSingleSessionApp.Contract.GetSettleFinalizedTime(&_SimpleSingleSessionApp.CallOpts) -} - -// GetSettleFinalizedTime is a free data retrieval call binding the contract method 0xb71ca01f. -// -// Solidity: function getSettleFinalizedTime() view returns(uint256) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) GetSettleFinalizedTime() (*big.Int, error) { - return _SimpleSingleSessionApp.Contract.GetSettleFinalizedTime(&_SimpleSingleSessionApp.CallOpts) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) GetState(opts *bind.CallOpts, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "getState", _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) GetState(_key *big.Int) ([]byte, error) { - return _SimpleSingleSessionApp.Contract.GetState(&_SimpleSingleSessionApp.CallOpts, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) GetState(_key *big.Int) ([]byte, error) { - return _SimpleSingleSessionApp.Contract.GetState(&_SimpleSingleSessionApp.CallOpts, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) GetStatus(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "getStatus") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) GetStatus() (uint8, error) { - return _SimpleSingleSessionApp.Contract.GetStatus(&_SimpleSingleSessionApp.CallOpts) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) GetStatus() (uint8, error) { - return _SimpleSingleSessionApp.Contract.GetStatus(&_SimpleSingleSessionApp.CallOpts) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleSingleSessionApp.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleSingleSessionApp.Contract.IsFinalized(&_SimpleSingleSessionApp.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppCallerSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleSingleSessionApp.Contract.IsFinalized(&_SimpleSingleSessionApp.CallOpts, _query) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0x1f2b71e5. -// -// Solidity: function applyAction(bytes _action) returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactor) ApplyAction(opts *bind.TransactOpts, _action []byte) (*types.Transaction, error) { - return _SimpleSingleSessionApp.contract.Transact(opts, "applyAction", _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0x1f2b71e5. -// -// Solidity: function applyAction(bytes _action) returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) ApplyAction(_action []byte) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.ApplyAction(&_SimpleSingleSessionApp.TransactOpts, _action) -} - -// ApplyAction is a paid mutator transaction binding the contract method 0x1f2b71e5. -// -// Solidity: function applyAction(bytes _action) returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactorSession) ApplyAction(_action []byte) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.ApplyAction(&_SimpleSingleSessionApp.TransactOpts, _action) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xfa5e7ff5. -// -// Solidity: function finalizeOnActionTimeout() returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactor) FinalizeOnActionTimeout(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleSingleSessionApp.contract.Transact(opts, "finalizeOnActionTimeout") -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xfa5e7ff5. -// -// Solidity: function finalizeOnActionTimeout() returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) FinalizeOnActionTimeout() (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.FinalizeOnActionTimeout(&_SimpleSingleSessionApp.TransactOpts) -} - -// FinalizeOnActionTimeout is a paid mutator transaction binding the contract method 0xfa5e7ff5. -// -// Solidity: function finalizeOnActionTimeout() returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactorSession) FinalizeOnActionTimeout() (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.FinalizeOnActionTimeout(&_SimpleSingleSessionApp.TransactOpts) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactor) IntendSettle(opts *bind.TransactOpts, _stateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionApp.contract.Transact(opts, "intendSettle", _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.IntendSettle(&_SimpleSingleSessionApp.TransactOpts, _stateProof) -} - -// IntendSettle is a paid mutator transaction binding the contract method 0x130d33fe. -// -// Solidity: function intendSettle(bytes _stateProof) returns() -func (_SimpleSingleSessionApp *SimpleSingleSessionAppTransactorSession) IntendSettle(_stateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionApp.Contract.IntendSettle(&_SimpleSingleSessionApp.TransactOpts, _stateProof) -} - -// SimpleSingleSessionAppIntendSettleIterator is returned from FilterIntendSettle and is used to iterate over the raw logs and unpacked data for IntendSettle events raised by the SimpleSingleSessionApp contract. -type SimpleSingleSessionAppIntendSettleIterator struct { - Event *SimpleSingleSessionAppIntendSettle // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleSingleSessionAppIntendSettleIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppIntendSettle) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleSingleSessionAppIntendSettleIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleSingleSessionAppIntendSettleIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleSingleSessionAppIntendSettle represents a IntendSettle event raised by the SimpleSingleSessionApp contract. -type SimpleSingleSessionAppIntendSettle struct { - Seq *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIntendSettle is a free log retrieval operation binding the contract event 0xce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a. -// -// Solidity: event IntendSettle(uint256 seq) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppFilterer) FilterIntendSettle(opts *bind.FilterOpts) (*SimpleSingleSessionAppIntendSettleIterator, error) { - - logs, sub, err := _SimpleSingleSessionApp.contract.FilterLogs(opts, "IntendSettle") - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppIntendSettleIterator{contract: _SimpleSingleSessionApp.contract, event: "IntendSettle", logs: logs, sub: sub}, nil -} - -// WatchIntendSettle is a free log subscription operation binding the contract event 0xce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a. -// -// Solidity: event IntendSettle(uint256 seq) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppFilterer) WatchIntendSettle(opts *bind.WatchOpts, sink chan<- *SimpleSingleSessionAppIntendSettle) (event.Subscription, error) { - - logs, sub, err := _SimpleSingleSessionApp.contract.WatchLogs(opts, "IntendSettle") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleSingleSessionAppIntendSettle) - if err := _SimpleSingleSessionApp.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIntendSettle is a log parse operation binding the contract event 0xce68db27527c6058059e8cbd1c6de0528ef1c417fe1c21c545919c7da3466d2a. -// -// Solidity: event IntendSettle(uint256 seq) -func (_SimpleSingleSessionApp *SimpleSingleSessionAppFilterer) ParseIntendSettle(log types.Log) (*SimpleSingleSessionAppIntendSettle, error) { - event := new(SimpleSingleSessionAppIntendSettle) - if err := _SimpleSingleSessionApp.contract.UnpackLog(event, "IntendSettle", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/testing/testapp/singlesessionappwithoracle.go b/testing/testapp/singlesessionappwithoracle.go deleted file mode 100644 index f460a15..0000000 --- a/testing/testapp/singlesessionappwithoracle.go +++ /dev/null @@ -1,943 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package testapp - -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" -) - -// 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 -) - -// SimpleSingleSessionAppWithOracleMetaData contains all meta data concerning the SimpleSingleSessionAppWithOracle contract. -var SimpleSingleSessionAppWithOracleMetaData = &bind.MetaData{ - ABI: "[{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleBySigTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getStatus\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidTurn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"isFinalized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"}],\"name\":\"settleByMoveTimeout\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_oracleProof\",\"type\":\"bytes\"},{\"name\":\"_cosignedStateProof\",\"type\":\"bytes\"}],\"name\":\"settleByInvalidState\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_players\",\"type\":\"address[]\"},{\"name\":\"_nonce\",\"type\":\"uint256\"},{\"name\":\"_sigTimeout\",\"type\":\"uint256\"},{\"name\":\"_moveTimeout\",\"type\":\"uint256\"},{\"name\":\"_oracle\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"SigTimeoutDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"MoveTimeoutDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"InvalidTurnDispute\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"InvalidStateDispute\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[{\"name\":\"_query\",\"type\":\"bytes\"}],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_key\",\"type\":\"uint256\"}],\"name\":\"getState\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b506040516200255f3803806200255f833981018060405260a08110156200003757600080fd5b8101908080516401000000008111156200005057600080fd5b828101905060208101848111156200006757600080fd5b81518560208202830111640100000000821117156200008557600080fd5b505092919060200180519060200190929190805190602001909291908051906020019092919080519060200190929190505050848484848484848484848360008001819055508460006001019080519060200190620000e692919062000178565b50826000600201819055508160006003018190555060008060040160006101000a81548160ff021916908360018111156200011d57fe5b021790555080600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050505050505050505050506200024d565b828054828255906000526020600020908101928215620001f4579160200282015b82811115620001f35782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000199565b5b50905062000203919062000207565b5090565b6200024a91905b808211156200024657600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016200020e565b5090565b90565b612302806200025d6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063bcdbda941161005b578063bcdbda94146102a7578063ea4ba8eb14610338578063f26285b2146103c9578063fb3fe8061461044257610088565b80632141dbda1461008d57806344c9af28146101065780634e69d560146101ad578063a428cd3b146101d9575b600080fd5b610104600480360360208110156100a357600080fd5b81019080803590602001906401000000008111156100c057600080fd5b8201836020820111156100d257600080fd5b803590602001918460018302840111640100000000831117156100f457600080fd5b9091929391929390505050610510565b005b6101326004803603602081101561011c57600080fd5b810190808035906020019092919050505061072b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610172578082015181840152602081019050610157565b50505050905090810190601f16801561019f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101b5610789565b604051808260018111156101c557fe5b60ff16815260200191505060405180910390f35b6102a5600480360360408110156101ef57600080fd5b810190808035906020019064010000000081111561020c57600080fd5b82018360208201111561021e57600080fd5b8035906020019184600183028401116401000000008311171561024057600080fd5b90919293919293908035906020019064010000000081111561026157600080fd5b82018360208201111561027357600080fd5b8035906020019184600183028401116401000000008311171561029557600080fd5b90919293919293905050506107a2565b005b61031e600480360360208110156102bd57600080fd5b81019080803590602001906401000000008111156102da57600080fd5b8201836020820111156102ec57600080fd5b8035906020019184600183028401116401000000008311171561030e57600080fd5b9091929391929390505050610a1c565b604051808215151515815260200191505060405180910390f35b6103af6004803603602081101561034e57600080fd5b810190808035906020019064010000000081111561036b57600080fd5b82018360208201111561037d57600080fd5b8035906020019184600183028401116401000000008311171561039f57600080fd5b9091929391929390505050610a60565b604051808215151515815260200191505060405180910390f35b610440600480360360208110156103df57600080fd5b81019080803590602001906401000000008111156103fc57600080fd5b82018360208201111561040e57600080fd5b8035906020019184600183028401116401000000008311171561043057600080fd5b9091929391929390505050610b14565b005b61050e6004803603604081101561045857600080fd5b810190808035906020019064010000000081111561047557600080fd5b82018360208201111561048757600080fd5b803590602001918460018302840111640100000000831117156104a957600080fd5b9091929391929390803590602001906401000000008111156104ca57600080fd5b8201836020820111156104dc57600080fd5b803590602001918460018302840111640100000000831117156104fe57600080fd5b9091929391929390505050610cd6565b005b60018081111561051c57fe5b600060040160009054906101000a900460ff16600181111561053a57fe5b14156105ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b6105b661215e565b61060383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610f10565b905080606001516000600201548260400151011061066c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602781526020018061226d6027913960400191505060405180910390fd5b6106746121a3565b606061068583600001516001611099565b915091506000600101805490508151106106ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612242602b913960400191505060405180910390fd5b6106f88260400151826110ea565b7f4ede5136b5765b273092424d192085d14577fe5c0b0512401b5d3706b46c8e2060405160405180910390a15050505050565b60608060206040519080825280601f01601f1916602001820160405280156107625781602001600182028038833980820191505090505b5090506000600560149054906101000a900460ff1690508060208301528192505050919050565b60008060040160009054906101000a900460ff16905090565b6001808111156107ae57fe5b600060040160009054906101000a900460ff1660018111156107cc57fe5b1415610840576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b6108486121a3565b606061089984848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506001611099565b915091506108a68161114a565b60006108b583604001516112c1565b90506108bf61215e565b61090c88888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610f10565b9050806020015173ffffffffffffffffffffffffffffffffffffffff1660006001018360ff168154811061093c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156109d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806122946021913960400191505060405180910390fd5b6109e6846040015182602001516112e5565b7f12583b36c4ceb396f9b64ae9b3055f92e067e9e27f25624468e49465c7d6d25860405160405180910390a15050505050505050565b6000808383905014610a2d57600080fd5b600180811115610a3957fe5b600060040160009054906101000a900460ff166001811115610a5757fe5b14905092915050565b600060018383905014610adb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e76616c6964207175657279206c656e67746800000000000000000000000081525060200191505060405180910390fd5b82826000818110610ae857fe5b9050013560f81c60f81b60f81c60ff16600560149054906101000a900460ff1660ff1614905092915050565b600180811115610b2057fe5b600060040160009054906101000a900460ff166001811115610b3e57fe5b1415610bb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b610bba61215e565b610c0783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610f10565b9050806060015160006003015482604001510110610c70576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061221a6028913960400191505060405180910390fd5b610c786121a3565b6060610c8983600001516001611099565b91509150610c968161114a565b610ca38260400151611345565b7f5ca2c3e34ecb38f5b6e98856236647247d4acb6a797617631c7815dc16ac0c1160405160405180910390a15050505050565b600180811115610ce257fe5b600060040160009054906101000a900460ff166001811115610d0057fe5b1415610d74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6170702073746174652069732066696e616c697a65640000000000000000000081525060200191505060405180910390fd5b610d7c6121a3565b6060610dcd84848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506001611099565b91509150610dda8161114a565b610de261215e565b610e2f87878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050610f10565b9050610e396121a3565b610e4882600001516000611099565b509050610e5584826113a4565b15610ec8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f6f7261636c65206170707374617465206d75737420626520696e76616c69640081525060200191505060405180910390fd5b610eda846040015183602001516113e8565b7f58857d7e5d46d366a88b9b19c3c4bfb7573323b8e0602e3966d582bac5aa5fca60405160405180910390a15050505050505050565b610f1861215e565b610f206121cb565b610f2983611448565b90506000610fab82600001516040516020018082805190602001908083835b60208310610f6b5780518252602082019150602081019050602083039250610f48565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206114f3565b90506000610fbd82846020015161154b565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611082576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f7369676e6572206d757374206265206f7261636c65000000000000000000000081525060200191505060405180910390fd5b61108f836000015161162b565b9350505050919050565b6110a16121a3565b60606110ab6121e5565b6110b48561186d565b90506110c381600001516119e4565b925083156110e2576110df836040015182602001516000611ad2565b91505b509250929050565b6001600060040160006101000a81548160ff0219169083600181111561110c57fe5b02179055508160018151811061111e57fe5b602001015160f81c60f81b60f81c600560146101000a81548160ff021916908360ff1602179055505050565b6000600101805490508151146111c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f696e76616c6964206e756d626572206f66207369676e6572730000000000000081525060200191505060405180910390fd5b60008090505b6000600101805490508110156112bd578181815181106111ea57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff166000600101828154811061121857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156112b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806122b56022913960400191505060405180910390fd5b80806001019150506111ce565b5050565b6000816000815181106112d057fe5b602001015160f81c60f81b60f81c9050919050565b6001600060040160006101000a81548160ff0219169083600181111561130757fe5b02179055508160018151811061131957fe5b602001015160f81c60f81b60f81c600560146101000a81548160ff021916908360ff1602179055505050565b6001600060040160006101000a81548160ff0219169083600181111561136757fe5b02179055508060018151811061137957fe5b602001015160f81c60f81b60f81c600560146101000a81548160ff021916908360ff16021790555050565b600081602001518360200151106113be57600090506113e2565b6113d083604001518360400151611ce9565b6113dd57600090506113e2565b600190505b92915050565b6001600060040160006101000a81548160ff0219169083600181111561140a57fe5b02179055508160018151811061141c57fe5b602001015160f81c60f81b60f81c600560146101000a81548160ff021916908360ff1602179055505050565b6114506121cb565b6114586121ff565b61146183611e35565b90506000805b61147083611e64565b156114eb5761147e83611e79565b8092508193505050600015611492576114e6565b60018214156114b1576114a483611ead565b84600001819052506114e5565b60028214156114d0576114c383611ead565b84602001819052506114e4565b6114e38184611f6690919063ffffffff16565b5b5b5b611467565b505050919050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b6000604182511461155f5760009050611625565b60008060006020850151925060408501519150606085015160001a9050601b8160ff16101561158f57601b810190505b601b8160ff16141580156115a75750601c8160ff1614155b156115b85760009350505050611625565b60018682858560405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611615573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b61163361215e565b61163b6121ff565b61164483611e35565b9050606061165c600583611ff690919063ffffffff16565b90508060058151811061166b57fe5b60200260200101516040519080825280602002602001820160405280156116a15781602001602082028038833980820191505090505b5083608001819052506000816005815181106116b957fe5b6020026020010181815250506000805b6116d284611e64565b15611864576116e084611e79565b80925081935050506000156116f45761185f565b60018214156117135761170684611ead565b856000018190525061185e565b60028214156117695761172d61172885611ead565b61209b565b856020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061185d565b60038214156117895761177b846120ad565b85604001818152505061185c565b60048214156117a95761179b846120ad565b85606001818152505061185b565b6005821415611846576117c36117be85611ead565b61209b565b8560800151846005815181106117d557fe5b6020026020010151815181106117e757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508260058151811061182e57fe5b6020026020010180518091906001018152505061185a565b6118598185611f6690919063ffffffff16565b5b5b5b5b5b5b6116c9565b50505050919050565b6118756121e5565b61187d6121ff565b61188683611e35565b9050606061189e600283611ff690919063ffffffff16565b9050806002815181106118ad57fe5b60200260200101516040519080825280602002602001820160405280156118e857816020015b60608152602001906001900390816118d35790505b50836020018190525060008160028151811061190057fe5b6020026020010181815250506000805b61191984611e64565b156119db5761192784611e79565b809250819350505060001561193b576119d6565b600182141561195a5761194d84611ead565b85600001819052506119d5565b60028214156119c05761196c84611ead565b85602001518460028151811061197e57fe5b60200260200101518151811061199057fe5b6020026020010181905250826002815181106119a857fe5b602002602001018051809190600101815250506119d4565b6119d38185611f6690919063ffffffff16565b5b5b5b611910565b50505050919050565b6119ec6121a3565b6119f46121ff565b6119fd83611e35565b90506000805b611a0c83611e64565b15611aca57611a1a83611e79565b8092508193505050600015611a2e57611ac5565b6001821415611a4e57611a40836120ad565b846000018181525050611ac4565b6002821415611a6e57611a60836120ad565b846020018181525050611ac3565b6003821415611a8d57611a8083611ead565b8460400181905250611ac2565b6004821415611aad57611a9f836120ad565b846060018181525050611ac1565b611ac08184611f6690919063ffffffff16565b5b5b5b5b5b611a03565b505050919050565b6060808351604051908082528060200260200182016040528015611b055781602001602082028038833980820191505090505b5090506000611b84866040516020018082805190602001908083835b60208310611b445780518252602082019150602081019050602083039250611b21565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001206114f3565b9050600080905060008090505b8651811015611cdb57611bb783888381518110611baa57fe5b602002602001015161154b565b848281518110611bc357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508515611cce578173ffffffffffffffffffffffffffffffffffffffff16848281518110611c2657fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1611611cb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f7369676e657273206e6f7420696e20617363656e64696e67206f72646572000081525060200191505060405180910390fd5b838181518110611cc357fe5b602002602001015191505b8080600101915050611b91565b508293505050509392505050565b60006002835114611d62576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f696e76616c696420636f7369676e6564207374617465206c656e67746800000081525060200191505060405180910390fd5b6002825114611d745760009050611e2f565b6000611d7f846112c1565b90506000611d8c846112c1565b90508060ff166000600101805490506001840160ff1681611da957fe5b0614611dba57600092505050611e2f565b600085600181518110611dc957fe5b602001015160f81c60f81b60f81c9050600085600181518110611de857fe5b602001015160f81c60f81b60f81c905060018260ff161480611e0d575060028260ff16145b15611e26578060ff168260ff1614945050505050611e2f565b60019450505050505b92915050565b611e3d6121ff565b6001825111611e4b57600080fd5b8181602001819052506000816000018181525050919050565b60008160200151518260000151109050919050565b6000806000611e87846120ad565b905060088181611e9357fe5b049250600781166005811115611ea557fe5b915050915091565b60606000611eba836120ad565b90506000818460000151019050836020015151811115611ed957600080fd5b816040519080825280601f01601f191660200182016040528015611f0c5781602001600182028038833980820191505090505b50925060608460200151905060008086600001519050602086019150806020840101905060008090505b85811015611f51578082015181840152602081019050611f36565b50838760000181815250505050505050919050565b60006005811115611f7357fe5b816005811115611f7f57fe5b1415611f9457611f8e826120ad565b50611ff2565b60026005811115611fa157fe5b816005811115611fad57fe5b1415611fec576000611fbe836120ad565b90508083600001818151019150818152505082602001515183600001511115611fe657600080fd5b50611ff1565b600080fd5b5b5050565b6060600083600001519050600183016040519080825280602002602001820160405280156120335781602001602082028038833980820191505090505b5091506000805b61204386611e64565b156120885761205186611e79565b8092508193505050600184838151811061206757fe5b6020026020010181815101915081815250506120838682611f66565b61203a565b8286600001818152505050505092915050565b60006120a682612133565b9050919050565b60008060608360200151905083600001519250826020820101519150600080935060008090505b600a8110156121285783811a915060078102607f8316901b85179450600060808316141561211b57600181018660000181815101915081815250508494505050505061212e565b80806001019150506120d4565b50600080fd5b919050565b6000601482511461214357600080fd5b6c010000000000000000000000006020830151049050919050565b6040518060a0016040528060608152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001606081525090565b6040518060800160405280600081526020016000815260200160608152602001600081525090565b604051806040016040528060608152602001606081525090565b604051806040016040528060608152602001606081525090565b60405180604001604052806000815260200160608152509056fe6f7261636c65207374617465206d757374206265206166746572206d6f766520646561646c696e657369676e657273206c656e677468206d75737420626520736d616c6c6572207468616e20706c61796572736f7261636c65207374617465206d7573742062652061667465722073696720646561646c696e656f7261636c652073746174652075736572206d75737420626520696e76616c696473746174652070726f6f66207369676e6572206d75737420626520636f7272656374a165627a7a7230582088b2d65da9605b4a847897fd4e15a3191ca2d3d8a925d14d0e030115a0b590d30029", -} - -// SimpleSingleSessionAppWithOracleABI is the input ABI used to generate the binding from. -// Deprecated: Use SimpleSingleSessionAppWithOracleMetaData.ABI instead. -var SimpleSingleSessionAppWithOracleABI = SimpleSingleSessionAppWithOracleMetaData.ABI - -// SimpleSingleSessionAppWithOracleBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use SimpleSingleSessionAppWithOracleMetaData.Bin instead. -var SimpleSingleSessionAppWithOracleBin = SimpleSingleSessionAppWithOracleMetaData.Bin - -// DeploySimpleSingleSessionAppWithOracle deploys a new Ethereum contract, binding an instance of SimpleSingleSessionAppWithOracle to it. -func DeploySimpleSingleSessionAppWithOracle(auth *bind.TransactOpts, backend bind.ContractBackend, _players []common.Address, _nonce *big.Int, _sigTimeout *big.Int, _moveTimeout *big.Int, _oracle common.Address) (common.Address, *types.Transaction, *SimpleSingleSessionAppWithOracle, error) { - parsed, err := SimpleSingleSessionAppWithOracleMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SimpleSingleSessionAppWithOracleBin), backend, _players, _nonce, _sigTimeout, _moveTimeout, _oracle) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SimpleSingleSessionAppWithOracle{SimpleSingleSessionAppWithOracleCaller: SimpleSingleSessionAppWithOracleCaller{contract: contract}, SimpleSingleSessionAppWithOracleTransactor: SimpleSingleSessionAppWithOracleTransactor{contract: contract}, SimpleSingleSessionAppWithOracleFilterer: SimpleSingleSessionAppWithOracleFilterer{contract: contract}}, nil -} - -// SimpleSingleSessionAppWithOracle is an auto generated Go binding around an Ethereum contract. -type SimpleSingleSessionAppWithOracle struct { - SimpleSingleSessionAppWithOracleCaller // Read-only binding to the contract - SimpleSingleSessionAppWithOracleTransactor // Write-only binding to the contract - SimpleSingleSessionAppWithOracleFilterer // Log filterer for contract events -} - -// SimpleSingleSessionAppWithOracleCaller is an auto generated read-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppWithOracleCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleSingleSessionAppWithOracleTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppWithOracleTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleSingleSessionAppWithOracleFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SimpleSingleSessionAppWithOracleFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SimpleSingleSessionAppWithOracleSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SimpleSingleSessionAppWithOracleSession struct { - Contract *SimpleSingleSessionAppWithOracle // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleSingleSessionAppWithOracleCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SimpleSingleSessionAppWithOracleCallerSession struct { - Contract *SimpleSingleSessionAppWithOracleCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SimpleSingleSessionAppWithOracleTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SimpleSingleSessionAppWithOracleTransactorSession struct { - Contract *SimpleSingleSessionAppWithOracleTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SimpleSingleSessionAppWithOracleRaw is an auto generated low-level Go binding around an Ethereum contract. -type SimpleSingleSessionAppWithOracleRaw struct { - Contract *SimpleSingleSessionAppWithOracle // Generic contract binding to access the raw methods on -} - -// SimpleSingleSessionAppWithOracleCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppWithOracleCallerRaw struct { - Contract *SimpleSingleSessionAppWithOracleCaller // Generic read-only contract binding to access the raw methods on -} - -// SimpleSingleSessionAppWithOracleTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SimpleSingleSessionAppWithOracleTransactorRaw struct { - Contract *SimpleSingleSessionAppWithOracleTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSimpleSingleSessionAppWithOracle creates a new instance of SimpleSingleSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleSingleSessionAppWithOracle(address common.Address, backend bind.ContractBackend) (*SimpleSingleSessionAppWithOracle, error) { - contract, err := bindSimpleSingleSessionAppWithOracle(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracle{SimpleSingleSessionAppWithOracleCaller: SimpleSingleSessionAppWithOracleCaller{contract: contract}, SimpleSingleSessionAppWithOracleTransactor: SimpleSingleSessionAppWithOracleTransactor{contract: contract}, SimpleSingleSessionAppWithOracleFilterer: SimpleSingleSessionAppWithOracleFilterer{contract: contract}}, nil -} - -// NewSimpleSingleSessionAppWithOracleCaller creates a new read-only instance of SimpleSingleSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleSingleSessionAppWithOracleCaller(address common.Address, caller bind.ContractCaller) (*SimpleSingleSessionAppWithOracleCaller, error) { - contract, err := bindSimpleSingleSessionAppWithOracle(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleCaller{contract: contract}, nil -} - -// NewSimpleSingleSessionAppWithOracleTransactor creates a new write-only instance of SimpleSingleSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleSingleSessionAppWithOracleTransactor(address common.Address, transactor bind.ContractTransactor) (*SimpleSingleSessionAppWithOracleTransactor, error) { - contract, err := bindSimpleSingleSessionAppWithOracle(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleTransactor{contract: contract}, nil -} - -// NewSimpleSingleSessionAppWithOracleFilterer creates a new log filterer instance of SimpleSingleSessionAppWithOracle, bound to a specific deployed contract. -func NewSimpleSingleSessionAppWithOracleFilterer(address common.Address, filterer bind.ContractFilterer) (*SimpleSingleSessionAppWithOracleFilterer, error) { - contract, err := bindSimpleSingleSessionAppWithOracle(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleFilterer{contract: contract}, nil -} - -// bindSimpleSingleSessionAppWithOracle binds a generic wrapper to an already deployed contract. -func bindSimpleSingleSessionAppWithOracle(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SimpleSingleSessionAppWithOracleMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleSingleSessionAppWithOracle.Contract.SimpleSingleSessionAppWithOracleCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SimpleSingleSessionAppWithOracleTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SimpleSingleSessionAppWithOracleTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SimpleSingleSessionAppWithOracle.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.contract.Transact(opts, method, params...) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCaller) GetOutcome(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleSingleSessionAppWithOracle.contract.Call(opts, &out, "getOutcome", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleSingleSessionAppWithOracle.Contract.GetOutcome(&_SimpleSingleSessionAppWithOracle.CallOpts, _query) -} - -// GetOutcome is a free data retrieval call binding the contract method 0xea4ba8eb. -// -// Solidity: function getOutcome(bytes _query) view returns(bool) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCallerSession) GetOutcome(_query []byte) (bool, error) { - return _SimpleSingleSessionAppWithOracle.Contract.GetOutcome(&_SimpleSingleSessionAppWithOracle.CallOpts, _query) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCaller) GetState(opts *bind.CallOpts, _key *big.Int) ([]byte, error) { - var out []interface{} - err := _SimpleSingleSessionAppWithOracle.contract.Call(opts, &out, "getState", _key) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) GetState(_key *big.Int) ([]byte, error) { - return _SimpleSingleSessionAppWithOracle.Contract.GetState(&_SimpleSingleSessionAppWithOracle.CallOpts, _key) -} - -// GetState is a free data retrieval call binding the contract method 0x44c9af28. -// -// Solidity: function getState(uint256 _key) view returns(bytes) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCallerSession) GetState(_key *big.Int) ([]byte, error) { - return _SimpleSingleSessionAppWithOracle.Contract.GetState(&_SimpleSingleSessionAppWithOracle.CallOpts, _key) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCaller) GetStatus(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _SimpleSingleSessionAppWithOracle.contract.Call(opts, &out, "getStatus") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) GetStatus() (uint8, error) { - return _SimpleSingleSessionAppWithOracle.Contract.GetStatus(&_SimpleSingleSessionAppWithOracle.CallOpts) -} - -// GetStatus is a free data retrieval call binding the contract method 0x4e69d560. -// -// Solidity: function getStatus() view returns(uint8) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCallerSession) GetStatus() (uint8, error) { - return _SimpleSingleSessionAppWithOracle.Contract.GetStatus(&_SimpleSingleSessionAppWithOracle.CallOpts) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCaller) IsFinalized(opts *bind.CallOpts, _query []byte) (bool, error) { - var out []interface{} - err := _SimpleSingleSessionAppWithOracle.contract.Call(opts, &out, "isFinalized", _query) - - if err != nil { - return *new(bool), err - } - - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) - - return out0, err - -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleSingleSessionAppWithOracle.Contract.IsFinalized(&_SimpleSingleSessionAppWithOracle.CallOpts, _query) -} - -// IsFinalized is a free data retrieval call binding the contract method 0xbcdbda94. -// -// Solidity: function isFinalized(bytes _query) view returns(bool) -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleCallerSession) IsFinalized(_query []byte) (bool, error) { - return _SimpleSingleSessionAppWithOracle.Contract.IsFinalized(&_SimpleSingleSessionAppWithOracle.CallOpts, _query) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactor) SettleByInvalidState(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.contract.Transact(opts, "settleByInvalidState", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleByInvalidState(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidState is a paid mutator transaction binding the contract method 0xfb3fe806. -// -// Solidity: function settleByInvalidState(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactorSession) SettleByInvalidState(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleByInvalidState(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactor) SettleByInvalidTurn(opts *bind.TransactOpts, _oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.contract.Transact(opts, "settleByInvalidTurn", _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleByInvalidTurn(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByInvalidTurn is a paid mutator transaction binding the contract method 0xa428cd3b. -// -// Solidity: function settleByInvalidTurn(bytes _oracleProof, bytes _cosignedStateProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactorSession) SettleByInvalidTurn(_oracleProof []byte, _cosignedStateProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleByInvalidTurn(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof, _cosignedStateProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactor) SettleByMoveTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.contract.Transact(opts, "settleByMoveTimeout", _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleByMoveTimeout(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SettleByMoveTimeout is a paid mutator transaction binding the contract method 0xf26285b2. -// -// Solidity: function settleByMoveTimeout(bytes _oracleProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactorSession) SettleByMoveTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleByMoveTimeout(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactor) SettleBySigTimeout(opts *bind.TransactOpts, _oracleProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.contract.Transact(opts, "settleBySigTimeout", _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleBySigTimeout(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SettleBySigTimeout is a paid mutator transaction binding the contract method 0x2141dbda. -// -// Solidity: function settleBySigTimeout(bytes _oracleProof) returns() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleTransactorSession) SettleBySigTimeout(_oracleProof []byte) (*types.Transaction, error) { - return _SimpleSingleSessionAppWithOracle.Contract.SettleBySigTimeout(&_SimpleSingleSessionAppWithOracle.TransactOpts, _oracleProof) -} - -// SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator is returned from FilterInvalidStateDispute and is used to iterate over the raw logs and unpacked data for InvalidStateDispute events raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator struct { - Event *SimpleSingleSessionAppWithOracleInvalidStateDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleInvalidStateDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleInvalidStateDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleSingleSessionAppWithOracleInvalidStateDispute represents a InvalidStateDispute event raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleInvalidStateDispute struct { - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInvalidStateDispute is a free log retrieval operation binding the contract event 0x58857d7e5d46d366a88b9b19c3c4bfb7573323b8e0602e3966d582bac5aa5fca. -// -// Solidity: event InvalidStateDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) FilterInvalidStateDispute(opts *bind.FilterOpts) (*SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.FilterLogs(opts, "InvalidStateDispute") - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleInvalidStateDisputeIterator{contract: _SimpleSingleSessionAppWithOracle.contract, event: "InvalidStateDispute", logs: logs, sub: sub}, nil -} - -// WatchInvalidStateDispute is a free log subscription operation binding the contract event 0x58857d7e5d46d366a88b9b19c3c4bfb7573323b8e0602e3966d582bac5aa5fca. -// -// Solidity: event InvalidStateDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) WatchInvalidStateDispute(opts *bind.WatchOpts, sink chan<- *SimpleSingleSessionAppWithOracleInvalidStateDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.WatchLogs(opts, "InvalidStateDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleSingleSessionAppWithOracleInvalidStateDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "InvalidStateDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInvalidStateDispute is a log parse operation binding the contract event 0x58857d7e5d46d366a88b9b19c3c4bfb7573323b8e0602e3966d582bac5aa5fca. -// -// Solidity: event InvalidStateDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) ParseInvalidStateDispute(log types.Log) (*SimpleSingleSessionAppWithOracleInvalidStateDispute, error) { - event := new(SimpleSingleSessionAppWithOracleInvalidStateDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "InvalidStateDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator is returned from FilterInvalidTurnDispute and is used to iterate over the raw logs and unpacked data for InvalidTurnDispute events raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator struct { - Event *SimpleSingleSessionAppWithOracleInvalidTurnDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleInvalidTurnDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleInvalidTurnDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleSingleSessionAppWithOracleInvalidTurnDispute represents a InvalidTurnDispute event raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleInvalidTurnDispute struct { - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInvalidTurnDispute is a free log retrieval operation binding the contract event 0x12583b36c4ceb396f9b64ae9b3055f92e067e9e27f25624468e49465c7d6d258. -// -// Solidity: event InvalidTurnDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) FilterInvalidTurnDispute(opts *bind.FilterOpts) (*SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.FilterLogs(opts, "InvalidTurnDispute") - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleInvalidTurnDisputeIterator{contract: _SimpleSingleSessionAppWithOracle.contract, event: "InvalidTurnDispute", logs: logs, sub: sub}, nil -} - -// WatchInvalidTurnDispute is a free log subscription operation binding the contract event 0x12583b36c4ceb396f9b64ae9b3055f92e067e9e27f25624468e49465c7d6d258. -// -// Solidity: event InvalidTurnDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) WatchInvalidTurnDispute(opts *bind.WatchOpts, sink chan<- *SimpleSingleSessionAppWithOracleInvalidTurnDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.WatchLogs(opts, "InvalidTurnDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleSingleSessionAppWithOracleInvalidTurnDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "InvalidTurnDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInvalidTurnDispute is a log parse operation binding the contract event 0x12583b36c4ceb396f9b64ae9b3055f92e067e9e27f25624468e49465c7d6d258. -// -// Solidity: event InvalidTurnDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) ParseInvalidTurnDispute(log types.Log) (*SimpleSingleSessionAppWithOracleInvalidTurnDispute, error) { - event := new(SimpleSingleSessionAppWithOracleInvalidTurnDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "InvalidTurnDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator is returned from FilterMoveTimeoutDispute and is used to iterate over the raw logs and unpacked data for MoveTimeoutDispute events raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator struct { - Event *SimpleSingleSessionAppWithOracleMoveTimeoutDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleMoveTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleMoveTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleSingleSessionAppWithOracleMoveTimeoutDispute represents a MoveTimeoutDispute event raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleMoveTimeoutDispute struct { - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMoveTimeoutDispute is a free log retrieval operation binding the contract event 0x5ca2c3e34ecb38f5b6e98856236647247d4acb6a797617631c7815dc16ac0c11. -// -// Solidity: event MoveTimeoutDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) FilterMoveTimeoutDispute(opts *bind.FilterOpts) (*SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.FilterLogs(opts, "MoveTimeoutDispute") - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleMoveTimeoutDisputeIterator{contract: _SimpleSingleSessionAppWithOracle.contract, event: "MoveTimeoutDispute", logs: logs, sub: sub}, nil -} - -// WatchMoveTimeoutDispute is a free log subscription operation binding the contract event 0x5ca2c3e34ecb38f5b6e98856236647247d4acb6a797617631c7815dc16ac0c11. -// -// Solidity: event MoveTimeoutDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) WatchMoveTimeoutDispute(opts *bind.WatchOpts, sink chan<- *SimpleSingleSessionAppWithOracleMoveTimeoutDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.WatchLogs(opts, "MoveTimeoutDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleSingleSessionAppWithOracleMoveTimeoutDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "MoveTimeoutDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMoveTimeoutDispute is a log parse operation binding the contract event 0x5ca2c3e34ecb38f5b6e98856236647247d4acb6a797617631c7815dc16ac0c11. -// -// Solidity: event MoveTimeoutDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) ParseMoveTimeoutDispute(log types.Log) (*SimpleSingleSessionAppWithOracleMoveTimeoutDispute, error) { - event := new(SimpleSingleSessionAppWithOracleMoveTimeoutDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "MoveTimeoutDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator is returned from FilterSigTimeoutDispute and is used to iterate over the raw logs and unpacked data for SigTimeoutDispute events raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator struct { - Event *SimpleSingleSessionAppWithOracleSigTimeoutDispute // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleSigTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SimpleSingleSessionAppWithOracleSigTimeoutDispute) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SimpleSingleSessionAppWithOracleSigTimeoutDispute represents a SigTimeoutDispute event raised by the SimpleSingleSessionAppWithOracle contract. -type SimpleSingleSessionAppWithOracleSigTimeoutDispute struct { - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSigTimeoutDispute is a free log retrieval operation binding the contract event 0x4ede5136b5765b273092424d192085d14577fe5c0b0512401b5d3706b46c8e20. -// -// Solidity: event SigTimeoutDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) FilterSigTimeoutDispute(opts *bind.FilterOpts) (*SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.FilterLogs(opts, "SigTimeoutDispute") - if err != nil { - return nil, err - } - return &SimpleSingleSessionAppWithOracleSigTimeoutDisputeIterator{contract: _SimpleSingleSessionAppWithOracle.contract, event: "SigTimeoutDispute", logs: logs, sub: sub}, nil -} - -// WatchSigTimeoutDispute is a free log subscription operation binding the contract event 0x4ede5136b5765b273092424d192085d14577fe5c0b0512401b5d3706b46c8e20. -// -// Solidity: event SigTimeoutDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) WatchSigTimeoutDispute(opts *bind.WatchOpts, sink chan<- *SimpleSingleSessionAppWithOracleSigTimeoutDispute) (event.Subscription, error) { - - logs, sub, err := _SimpleSingleSessionAppWithOracle.contract.WatchLogs(opts, "SigTimeoutDispute") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SimpleSingleSessionAppWithOracleSigTimeoutDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "SigTimeoutDispute", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSigTimeoutDispute is a log parse operation binding the contract event 0x4ede5136b5765b273092424d192085d14577fe5c0b0512401b5d3706b46c8e20. -// -// Solidity: event SigTimeoutDispute() -func (_SimpleSingleSessionAppWithOracle *SimpleSingleSessionAppWithOracleFilterer) ParseSigTimeoutDispute(log types.Log) (*SimpleSingleSessionAppWithOracleSigTimeoutDispute, error) { - event := new(SimpleSingleSessionAppWithOracleSigTimeoutDispute) - if err := _SimpleSingleSessionAppWithOracle.contract.UnpackLog(event, "SigTimeoutDispute", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/testing/testapp/utils.go b/testing/testapp/utils.go deleted file mode 100644 index d624f1b..0000000 --- a/testing/testapp/utils.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018-2025 Celer Network - -package testapp - -import ( - "math/big" - "strings" - - "github.com/celer-network/agent-pay/app" - "github.com/celer-network/agent-pay/ctype" - "github.com/celer-network/goutils/log" - "github.com/ethereum/go-ethereum/accounts/abi" - "google.golang.org/protobuf/proto" -) - -var ( - AppCode = ctype.Hex2Bytes(SimpleSingleSessionAppBin) - AppWithOracleCode = ctype.Hex2Bytes(SimpleSingleSessionAppWithOracleBin) - Nonce = big.NewInt(666) - Timeout = big.NewInt(2) - PlayerNum = big.NewInt(2) - ContractAddr = "58712219a4bdbb0e581dcaf6f5c4c2b2d2f42158" - ContractWithOracleAddr = "283ab9db53f25d84fa30915816ec53f8affaa86e" - - GomokuMinOffChain = uint8(0) - GomokuMaxOnChain = uint8(10) - GomokuAddr = "4e4a0101cd72258183586a51f8254e871b9c544a" -) - -// GetSingleSessionConstructor generates abi-conforming constructors for SingleSession App -func GetSingleSessionConstructor(players []ctype.Addr) []byte { - abi, err := abi.JSON(strings.NewReader(SimpleSingleSessionAppABI)) - input, err := abi.Pack("", players, Nonce, Timeout) - if err != nil { - log.Error(err) - } - return input -} - -func GetSingleSessionWithOracleConstructor(players []ctype.Addr, oracle ctype.Addr) []byte { - abi, err := abi.JSON(strings.NewReader(SimpleSingleSessionAppABI)) - input, err := abi.Pack("", players, Nonce, Timeout, Timeout, oracle) - if err != nil { - log.Error(err) - } - return input -} - -func GetAppState(winner uint8, nonce uint64) []byte { - appState := &app.AppState{ - Nonce: nonce, - SeqNum: 10, - State: []byte{winner}, - } - serializedAppState, err := proto.Marshal(appState) - if err != nil { - log.Error(err) - } - return serializedAppState -} - -func GetAppStateWithOracle(turn uint8, winner uint8, nonce uint64) []byte { - appState := &app.AppState{ - Nonce: nonce, - SeqNum: 10, - State: []byte{turn, winner}, - } - serializedAppState, err := proto.Marshal(appState) - if err != nil { - log.Error(err) - } - return serializedAppState -} - -func GetGetGomokuBoardState() []byte { - var state [228]byte - state[1] = 2 // turn - state[2] = 1 - state[3] = 1 - return state[:] -} - -func GetGomokuState() []byte { - appState := &app.AppState{ - Nonce: Nonce.Uint64(), - SeqNum: 10, - State: GetGetGomokuBoardState(), - Timeout: 3, - } - serializedAppState, err := proto.Marshal(appState) - if err != nil { - log.Error(err) - } - return serializedAppState -} diff --git a/tools/channel-migration/channel_migrate.go b/tools/channel-migration/channel_migrate.go index f401006..a4e3e97 100644 --- a/tools/channel-migration/channel_migrate.go +++ b/tools/channel-migration/channel_migrate.go @@ -176,13 +176,8 @@ func handleSingleOnchainTx( log.Infof("Found low gas price for channel %x migration: %d", cid, gasPrice.Uint64()) // check if current migration request is expired - header, err := client.HeaderByNumber(context.Background(), nil) - if err != nil { - log.Errorln(err) - return txFailed - } - currentBlockNum := header.Number.Uint64() - if deadlines[cid] <= currentBlockNum { + nowTs := uint64(time.Now().Unix()) + if deadlines[cid] <= nowTs { log.Infof("migration request has been expired for channel %x", cid) return txExpired } diff --git a/tools/osp-cli/README.md b/tools/osp-cli/README.md index 169f382..d18a80c 100644 --- a/tools/osp-cli/README.md +++ b/tools/osp-cli/README.md @@ -48,7 +48,7 @@ Note: `chanstate` is enum integer, valid states for commands above include 3 for * `-onchainview channel -cid [channel ID]`: get onchain channel info from CelerLedger contract * `-onchainview pay -payid [payment ID]`: get onchain payment info from PayRegistry contract * `-onchainview tx -txhash [transaction hash]`: get on-chain transaction information -* `-onchainview app -appaddr [app contract addr] -outcome [arg for query outcome] -finalize [arg for query finalization] -decode`: get onchain CelerApp session info +* `-onchainview app -appaddr [app contract addr] -outcome [arg for query outcome] -finalize [arg for query finalization]`: query an `IBooleanCond` condition contract on-chain (`isFinalized` and `getOutcome`) ### Unilateral channel settle or withdraw action diff --git a/tools/osp-cli/cli/cli_db_view.go b/tools/osp-cli/cli/cli_db_view.go index fb3c857..6ab9f07 100644 --- a/tools/osp-cli/cli/cli_db_view.go +++ b/tools/osp-cli/cli/cli_db_view.go @@ -3,7 +3,6 @@ package cli import ( - "context" "fmt" "math/big" "time" @@ -138,15 +137,9 @@ func (p *Processor) printChannelInfo(cid ctype.CidType) { "receiver", ctype.Addr2Hex(bal.PendingWithdrawal.Receiver), "deadline", bal.PendingWithdrawal.Deadline) } } - blknum := ^uint64(0) - header, err := p.nodeConfig.GetEthConn().HeaderByNumber(context.Background(), nil) - if err != nil { - log.Error(err) - } else { - blknum = header.Number.Uint64() - } + nowTs := uint64(time.Now().Unix()) balance := ledgerview.ComputeBalance(selfsimplex, peersimplex, bal, - ctype.Bytes2Addr(selfsimplex.GetPeerFrom()), ctype.Bytes2Addr(peersimplex.GetPeerFrom()), blknum) + ctype.Bytes2Addr(selfsimplex.GetPeerFrom()), ctype.Bytes2Addr(peersimplex.GetPeerFrom()), nowTs) fmt.Println("-- self free balance:", balance.MyFree, "locked balance:", balance.MyLocked) fmt.Println("-- peer free balance:", balance.PeerFree, "locked balance:", balance.PeerLocked) } @@ -284,13 +277,7 @@ func (p *Processor) printDetailedChannels(token *entity.TokenInfo, state int, in log.Fatal(err) } - blknum := ^uint64(0) - header, err := p.nodeConfig.GetEthConn().HeaderByNumber(context.Background(), nil) - if err != nil { - log.Error(err) - } else { - blknum = header.Number.Uint64() - } + nowTs := uint64(time.Now().Unix()) for i, _ := range cids { fmt.Println("-- channel ID:", ctype.Cid2Hex(cids[i])) tk := utils.PrintToken(tokens[i]) @@ -299,7 +286,7 @@ func (p *Processor) printDetailedChannels(token *entity.TokenInfo, state int, in fmt.Println("-- onchain balance: self deposit", balances[i].MyDeposit, "self withdrawal", balances[i].MyWithdrawal) fmt.Println("-- onchain balance: peer deposit", balances[i].PeerDeposit, "peer withdrawal", balances[i].PeerWithdrawal) balance := ledgerview.ComputeBalance(selfSimplexes[i], peerSimplexes[i], balances[i], - ctype.Bytes2Addr(selfSimplexes[i].GetPeerFrom()), ctype.Bytes2Addr(peerSimplexes[i].GetPeerFrom()), blknum) + ctype.Bytes2Addr(selfSimplexes[i].GetPeerFrom()), ctype.Bytes2Addr(peerSimplexes[i].GetPeerFrom()), nowTs) fmt.Println("-- self free balance:", balance.MyFree, "locked balance:", balance.MyLocked) fmt.Println("-- peer free balance:", balance.PeerFree, "locked balance:", balance.PeerLocked) fmt.Println() @@ -323,18 +310,12 @@ func (p *Processor) printTokenBalance(token *entity.TokenInfo, state int) { if err != nil { log.Fatal(err) } - blknum := ^uint64(0) - header, err := p.nodeConfig.GetEthConn().HeaderByNumber(context.Background(), nil) - if err != nil { - log.Error(err) - } else { - blknum = header.Number.Uint64() - } + nowTs := uint64(time.Now().Unix()) freeBalance := new(big.Int).SetUint64(0) lockedBalance := new(big.Int).SetUint64(0) for i, _ := range cids { balance := ledgerview.ComputeBalance(selfSimplexes[i], peerSimplexes[i], balances[i], - ctype.Bytes2Addr(selfSimplexes[i].GetPeerFrom()), ctype.Bytes2Addr(peerSimplexes[i].GetPeerFrom()), blknum) + ctype.Bytes2Addr(selfSimplexes[i].GetPeerFrom()), ctype.Bytes2Addr(peerSimplexes[i].GetPeerFrom()), nowTs) freeBalance = freeBalance.Add(freeBalance, balance.MyFree) lockedBalance = lockedBalance.Add(lockedBalance, balance.MyLocked) } diff --git a/tools/osp-cli/cli/cli_flags.go b/tools/osp-cli/cli/cli_flags.go index 38a02ea..bd636f9 100644 --- a/tools/osp-cli/cli/cli_flags.go +++ b/tools/osp-cli/cli/cli_flags.go @@ -45,7 +45,6 @@ var ( appaddr = flag.String("appaddr", "", "app onchain address") argfinalize = flag.String("finalize", "", "arg for query finalized") argoutcome = flag.String("outcome", "", "arg for query outcome") - argdecode = flag.Bool("decode", false, "decode arg according to multisession app format") netid = flag.Uint64("netid", 0, "net id") bridgeaddr = flag.String("bridgeaddr", "", "net bridge address") localtoken = flag.String("localtoken", "", "local token address") diff --git a/tools/osp-cli/cli/cli_onchain_op.go b/tools/osp-cli/cli/cli_onchain_op.go index 95dad22..7ebbc4c 100644 --- a/tools/osp-cli/cli/cli_onchain_op.go +++ b/tools/osp-cli/cli/cli_onchain_op.go @@ -41,12 +41,12 @@ func (p *Processor) EthPoolWithdraw() { func (p *Processor) RegisterRouter() { // check router registration - blk, err := p.queryRouterRegistry() + ts, err := p.queryRouterRegistry() if err != nil { return } // registry router - if blk == 0 { + if ts == 0 { err = p.registerRouter() if err != nil { return @@ -58,12 +58,12 @@ func (p *Processor) RegisterRouter() { func (p *Processor) DeregisterRouter() { // check router registration - blk, err := p.queryRouterRegistry() + ts, err := p.queryRouterRegistry() if err != nil { return } // registry router - if blk == 0 { + if ts == 0 { log.Info("OSP not registered as a network router") return } @@ -189,16 +189,16 @@ func (p *Processor) queryRouterRegistry() (uint64, error) { log.Error(err) return 0, err } - blk, err := contract.RouterInfo(&bind.CallOpts{}, p.myAddr) + info, err := contract.RouterInfo(&bind.CallOpts{}, p.myAddr) if err != nil { log.Error(err) return 0, err } - blknum := blk.Uint64() - if blknum != 0 { - log.Infoln("router registered / refreshed at block", blknum) + ts := info.Uint64() + if ts != 0 { + log.Infoln("router registered / refreshed at unix-ts", ts) } - return blknum, nil + return ts, nil } func (p *Processor) registerRouter() error { diff --git a/tools/osp-cli/cli/cli_onchain_view.go b/tools/osp-cli/cli/cli_onchain_view.go index dc5d1b0..ce0d0d9 100644 --- a/tools/osp-cli/cli/cli_onchain_view.go +++ b/tools/osp-cli/cli/cli_onchain_view.go @@ -3,8 +3,8 @@ package cli import ( - "context" "fmt" + "time" "github.com/celer-network/agent-pay/app" "github.com/celer-network/agent-pay/chain/channel-eth-go/ledger" @@ -13,7 +13,6 @@ import ( "github.com/celer-network/agent-pay/ledgerview" "github.com/celer-network/goutils/log" "github.com/ethereum/go-ethereum/accounts/abi/bind" - "google.golang.org/protobuf/proto" ) func (p *Processor) ViewChannelOnChain() { @@ -82,19 +81,13 @@ func (p *Processor) printChannelLedgerInfo(cid ctype.CidType) { fmt.Println("-- total balance:", balance) if status == ledgerview.OnChainStatus_SETTLING { - var blknum int64 - header, err := p.nodeConfig.GetEthConn().HeaderByNumber(context.Background(), nil) + finalizeTs, err := contract.GetSettleFinalizedTime(&bind.CallOpts{}, cid) if err != nil { - log.Error(err) - } else { - blknum = header.Number.Int64() + log.Fatalln("GetSettleFinalizedTime error", err) } - finalizeBlk, err2 := contract.GetSettleFinalizedTime(&bind.CallOpts{}, cid) - if err2 != nil { - log.Fatalln("GetSettleFinalizedTime error", err2) - } - finalizeBlknum := finalizeBlk.Int64() - fmt.Printf("-- settle finalized block %d, current block %d, diff %d\n", finalizeBlknum, blknum, finalizeBlknum-blknum) + nowTs := time.Now().Unix() + fmt.Printf("-- settle finalized at unix-ts %d, current %d, diff %d\n", + finalizeTs.Int64(), nowTs, finalizeTs.Int64()-nowTs) } // TODO: add other info } @@ -116,18 +109,7 @@ func (p Processor) printPayRegistryInfo(payID ctype.PayIDType) { func (p Processor) printAppBooleanOutcome(appAddr ctype.Addr, argF, argO []byte) { fmt.Println("") - if *argdecode { - var sq app.SessionQuery - err := proto.Unmarshal(argO, &sq) - if err != nil { - log.Error(err) - } else { - session := ctype.Bytes2Hex(sq.GetSession()) - query := ctype.Bytes2Hex(sq.GetQuery()) - fmt.Println("-- app session", session, "query", query) - } - } - contract, err := app.NewIBooleanOutcomeCaller(appAddr, p.nodeConfig.GetEthConn()) + contract, err := app.NewIBooleanCondCaller(appAddr, p.nodeConfig.GetEthConn()) if err != nil { log.Fatal(err) } diff --git a/tools/scripts/README.md b/tools/scripts/README.md index 52a1b44..8ded446 100644 --- a/tools/scripts/README.md +++ b/tools/scripts/README.md @@ -24,11 +24,18 @@ Generated outputs covered by this script: - `chain/channel-eth-go/wallet/wallet.go` - `chain/erc20.go` - `route/routerregistry/routerregistry.go` +- `app/booleancond.go` (regenerated from `agent-pay-contracts/src/lib/interface/IBooleanCond.sol`; the canonical off-chain `IBooleanCond` binding consumed by `AppClient.GetBooleanOutcome`) Handwritten exception: - `chain/channel-eth-go/deploy/deploy.go` is maintained manually and is not regenerated. +Generated-file header convention: + +The script prepends `// Regenerated by tools/scripts/regenerate-go-bindings.sh — DO NOT EDIT.` as the first line of each output (above abigen's own `Code generated - DO NOT EDIT.` banner) so a future reader who edits a generated file by mistake sees the right script to re-run. The post-AS-D bindings (`app/booleancond.go`, `testing/testapp/booleancondmock.go`) already carry this breadcrumb. The pre-existing chain bindings (`chain/channel-eth-go/...`, `chain/erc20.go`, `route/routerregistry/routerregistry.go`) will pick it up the next time they're regenerated — that produces a one-line diff per file unrelated to whatever else triggered the regen, which is expected. + +`regenerate-legacy-app-bindings.sh` does the same thing for its lone survivor. + Default behavior: - looks for a sibling contracts checkout at `../agent-pay-contracts` @@ -64,32 +71,6 @@ OUTPUT_ROOT="$tmp" tools/scripts/regenerate-go-bindings.sh find "$tmp" -type f | sort ``` -## Regenerate Legacy App Bindings - -Use [regenerate-legacy-app-bindings.sh](./regenerate-legacy-app-bindings.sh) to regenerate the legacy ABI-based Go bindings that are checked into this repo under `app/` and `testing/testapp/`. - -This script extracts ABI and bytecode literals from the existing Go source files, then reruns `abigen` against them. It does not depend on the companion contracts repo. - -Default behavior: - -- runs `abigen` through `go run github.com/ethereum/go-ethereum/cmd/abigen@v1.15.11` -- rewrites the existing checked-in files in place - -Required tools: - -- `go` - -Optional environment variables: - -- `ABIGEN_VERSION`: override the default pinned `abigen` version -- `ABIGEN`: use an already-installed `abigen` binary instead of `go run ...` - -Usage: - -```bash -tools/scripts/regenerate-legacy-app-bindings.sh -``` - ## Local CockroachDB Helper Use [cockroachdb.sh](./cockroachdb.sh) as a lightweight local helper to start or stop a CockroachDB instance for development. diff --git a/tools/scripts/regenerate-go-bindings.sh b/tools/scripts/regenerate-go-bindings.sh index b7d932b..a281f29 100755 --- a/tools/scripts/regenerate-go-bindings.sh +++ b/tools/scripts/regenerate-go-bindings.sh @@ -69,6 +69,14 @@ generate_binding() { --pkg "$pkg" \ --type "$type_name" \ --out "$output" + # Prepend a regen-script breadcrumb so a future reader who edits the + # generated file by mistake sees the right script to re-run. + local tmp="$TMP_DIR/${pkg}_${type_name}.go" + { + echo "// Regenerated by tools/scripts/regenerate-go-bindings.sh — DO NOT EDIT." + cat "$output" + } > "$tmp" + mv "$tmp" "$output" } generate_binding out/LedgerBalanceLimit.sol/LedgerBalanceLimit.json chain/channel-eth-go/balancelimit/balancelimit.go balancelimit LedgerBalanceLimit @@ -85,5 +93,7 @@ generate_binding out/VirtContractResolver.sol/VirtContractResolver.json chain/ch generate_binding out/CelerWallet.sol/CelerWallet.json chain/channel-eth-go/wallet/wallet.go wallet CelerWallet generate_binding out/ERC20ExampleToken.sol/ERC20ExampleToken.json chain/erc20.go chain ERC20 generate_binding out/RouterRegistry.sol/RouterRegistry.json route/routerregistry/routerregistry.go routerregistry RouterRegistry +generate_binding out/IBooleanCond.sol/IBooleanCond.json app/booleancond.go app IBooleanCond +generate_binding out/BooleanCondMock.sol/BooleanCondMock.json testing/testapp/booleancondmock.go testapp BooleanCondMock echo "generated bindings under $OUTPUT_ROOT" \ No newline at end of file diff --git a/tools/scripts/regenerate-legacy-app-bindings.sh b/tools/scripts/regenerate-legacy-app-bindings.sh deleted file mode 100755 index 14f34c8..0000000 --- a/tools/scripts/regenerate-legacy-app-bindings.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) -REPO_ROOT=$(cd -- "$SCRIPT_DIR/../.." && pwd) -ABIGEN_VERSION=${ABIGEN_VERSION:-v1.15.11} - -need_cmd() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "missing required command: $1" >&2 - exit 1 - fi -} - -need_cmd go - -if [[ -n "${ABIGEN:-}" ]]; then - ABIGEN_CMD=("$ABIGEN") -else - ABIGEN_CMD=(go run "github.com/ethereum/go-ethereum/cmd/abigen@${ABIGEN_VERSION}") -fi - -TMP_DIR=$(mktemp -d "${TMPDIR:-/tmp}/agent-pay-legacy-bindings.XXXXXX") -trap 'rm -rf "$TMP_DIR"' EXIT - -EXTRACTOR_SRC="$TMP_DIR/extract.go" -EXTRACTOR_BIN="$TMP_DIR/extract" - -cat > "$EXTRACTOR_SRC" <<'EOF' -package main - -import ( - "fmt" - "os" - "regexp" - "strconv" - "strings" -) - -func main() { - if len(os.Args) != 3 { - fmt.Fprintln(os.Stderr, "usage: extract ") - os.Exit(2) - } - - data, err := os.ReadFile(os.Args[1]) - if err != nil { - panic(err) - } - - symbol := regexp.QuoteMeta(os.Args[2]) - directRe := regexp.MustCompile(`(?s)(?:const|var)\s+` + symbol + `\s*=\s*("(?:\\.|[^"\\])*")`) - match := directRe.FindSubmatch(data) - if match == nil { - field := "" - metaName := "" - rawSymbol := os.Args[2] - switch { - case strings.HasSuffix(rawSymbol, "ABI"): - field = "ABI" - metaName = strings.TrimSuffix(rawSymbol, "ABI") + "MetaData" - case strings.HasSuffix(rawSymbol, "Bin"): - field = "Bin" - metaName = strings.TrimSuffix(rawSymbol, "Bin") + "MetaData" - } - if field != "" { - metaRe := regexp.MustCompile(`(?s)var\s+` + regexp.QuoteMeta(metaName) + `\s*=\s*&bind\.MetaData\s*\{.*?\b` + field + `:\s*("(?:\\.|[^"\\])*")`) - match = metaRe.FindSubmatch(data) - } - } - if match == nil { - fmt.Fprintf(os.Stderr, "symbol not found: %s\n", os.Args[2]) - os.Exit(1) - } - - value, err := strconv.Unquote(string(match[1])) - if err != nil { - panic(err) - } - - fmt.Print(value) -} -EOF - -go build -o "$EXTRACTOR_BIN" "$EXTRACTOR_SRC" - -extract_literal() { - "$EXTRACTOR_BIN" "$1" "$2" -} - -generate_from_abi() { - local input_rel=$1 - local output_rel=$2 - local pkg=$3 - local type_name=$4 - local input="$REPO_ROOT/$input_rel" - local output="$REPO_ROOT/$output_rel" - local abi_json="$TMP_DIR/${pkg}_${type_name}.abi.json" - - extract_literal "$input" "${type_name}ABI" > "$abi_json" - mkdir -p "$(dirname -- "$output")" - "${ABIGEN_CMD[@]}" --abi "$abi_json" --pkg "$pkg" --type "$type_name" --out "$output" -} - -generate_from_abi_bin() { - local input_rel=$1 - local output_rel=$2 - local pkg=$3 - local type_name=$4 - local input="$REPO_ROOT/$input_rel" - local output="$REPO_ROOT/$output_rel" - local abi_json="$TMP_DIR/${pkg}_${type_name}.abi.json" - local bytecode_txt="$TMP_DIR/${pkg}_${type_name}.bin" - - extract_literal "$input" "${type_name}ABI" > "$abi_json" - extract_literal "$input" "${type_name}Bin" > "$bytecode_txt" - mkdir -p "$(dirname -- "$output")" - "${ABIGEN_CMD[@]}" \ - --abi "$abi_json" \ - --bin "$bytecode_txt" \ - --pkg "$pkg" \ - --type "$type_name" \ - --out "$output" -} - -generate_from_abi app/booleanoutcome.go app/booleanoutcome.go app IBooleanOutcome -generate_from_abi app/numericoutcome.go app/numericoutcome.go app INumericOutcome -generate_from_abi app/multisession.go app/multisession.go app IMultiSession -generate_from_abi app/multisessionwithoracle.go app/multisessionwithoracle.go app IMultiSessionWithOracle -generate_from_abi app/singlesession.go app/singlesession.go app ISingleSession -generate_from_abi app/singlesessionwithoracle.go app/singlesessionwithoracle.go app ISingleSessionWithOracle - -generate_from_abi_bin testing/testapp/multigomoku.go testing/testapp/multigomoku.go testapp MultiGomoku -generate_from_abi_bin testing/testapp/multisessionapp.go testing/testapp/multisessionapp.go testapp SimpleMultiSessionApp -generate_from_abi_bin testing/testapp/multisessionappwithoracle.go testing/testapp/multisessionappwithoracle.go testapp SimpleMultiSessionAppWithOracle -generate_from_abi_bin testing/testapp/singlesessionapp.go testing/testapp/singlesessionapp.go testapp SimpleSingleSessionApp -generate_from_abi_bin testing/testapp/singlesessionappwithoracle.go testing/testapp/singlesessionappwithoracle.go testapp SimpleSingleSessionAppWithOracle - -echo "generated legacy app bindings under $REPO_ROOT" \ No newline at end of file diff --git a/webapi/api_server.go b/webapi/api_server.go index d784ec8..670178a 100644 --- a/webapi/api_server.go +++ b/webapi/api_server.go @@ -27,20 +27,21 @@ import ( "github.com/improbable-eng/grpc-web/go/grpcweb" "github.com/rs/cors" "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" empty "google.golang.org/protobuf/types/known/emptypb" ) type ApiServer struct { - webPort int - grpcPort int - allowedOrigins string - apiClient *celersdk.Client - payIter *celersdk.PayHistoryIterator - callbackImpl *callbackImpl - appSessionMap map[string]*celersdk.AppSession - appSessionMapLock sync.Mutex - appSessionCallbackMap map[string]*appSessionCallback - appSessionCallbackMapLock sync.Mutex + rpc.UnimplementedWebApiServer + webPort int + grpcPort int + allowedOrigins string + apiClient *celersdk.Client + payIter *celersdk.PayHistoryIterator + callbackImpl *callbackImpl + appSessionMap map[string]*celersdk.AppSession + appSessionMapLock sync.Mutex } // implement celersdk.ExternalSignerCallback interface @@ -71,12 +72,11 @@ func NewApiServer( useExtSigner bool) *ApiServer { callbackImpl := NewCallbackImpl() s := &ApiServer{ - webPort: webPort, - grpcPort: grpcPort, - allowedOrigins: allowedOrigins, - callbackImpl: callbackImpl, - appSessionMap: make(map[string]*celersdk.AppSession), - appSessionCallbackMap: make(map[string]*appSessionCallback), + webPort: webPort, + grpcPort: grpcPort, + allowedOrigins: allowedOrigins, + callbackImpl: callbackImpl, + appSessionMap: make(map[string]*celersdk.AppSession), } if !useExtSigner { go celersdk.InitClient( @@ -675,8 +675,8 @@ func (s *ApiServer) ConfirmSettlePaymentChannel( } func (s *ApiServer) GetSettleFinalizedTimeForPaymentChannel( - context context.Context, request *rpc.TokenInfo) (*rpc.BlockNumber, error) { - time, err := s.apiClient.GetSettleFinalizedTimeForPaymentChannel( + context context.Context, request *rpc.TokenInfo) (*rpc.Timestamp, error) { + ts, err := s.apiClient.GetSettleFinalizedTimeForPaymentChannel( &celersdk.TokenInfo{ TokenType: celersdk.TokenType(int32(request.TokenType)), TokenAddress: request.TokenAddress, @@ -684,7 +684,7 @@ func (s *ApiServer) GetSettleFinalizedTimeForPaymentChannel( if err != nil { return nil, err } - return &rpc.BlockNumber{BlockNumber: uint64(time)}, nil + return &rpc.Timestamp{Timestamp: uint64(ts)}, nil } // GetPayHistory returns paginated pay history. @@ -740,55 +740,15 @@ func (s *ApiServer) SyncStateWithPeer( return &empty.Empty{}, nil } -type appSessionCallback struct { - seqNumChan chan int -} - -func (cb *appSessionCallback) OnDispute(seqNum int) { - select { - case cb.seqNumChan <- seqNum: - default: - } -} - func (s *ApiServer) CreateAppSessionOnVirtualContract( context context.Context, request *rpc.CreateAppSessionOnVirtualContractRequest) ( *rpc.SessionID, error) { - callback := &appSessionCallback{seqNumChan: make(chan int)} session, err := s.apiClient.CreateAppSessionOnVirtualContract( request.ContractBin, request.ContractConstructor, - request.Nonce, - request.OnChainTimeout, - callback) - if err != nil { - return nil, err - } - sessionID := session.ID - s.appSessionMapLock.Lock() - s.appSessionMap[sessionID] = session - s.appSessionMapLock.Unlock() - s.appSessionCallbackMapLock.Lock() - s.appSessionCallbackMap[sessionID] = callback - s.appSessionCallbackMapLock.Unlock() - return &rpc.SessionID{SessionId: sessionID}, nil -} - -func (s *ApiServer) CreateAppSessionOnDeployedContract( - context context.Context, - request *rpc.CreateAppSessionOnDeployedContractRequest) ( - *rpc.SessionID, error) { - callback := &appSessionCallback{seqNumChan: make(chan int)} - participants := strings.Join(request.Participants, ",") - session, err := - s.apiClient.CreateAppSessionOnDeployedContract( - request.ContractAddress, - request.Nonce, - request.OnChainTimeout, - participants, - callback) + request.Nonce) if err != nil { return nil, err } @@ -796,63 +756,9 @@ func (s *ApiServer) CreateAppSessionOnDeployedContract( s.appSessionMapLock.Lock() s.appSessionMap[sessionID] = session s.appSessionMapLock.Unlock() - s.appSessionCallbackMapLock.Lock() - s.appSessionCallbackMap[sessionID] = callback - s.appSessionCallbackMapLock.Unlock() return &rpc.SessionID{SessionId: sessionID}, nil } -func (s *ApiServer) SubscribeAppSessionDispute( - request *rpc.SessionID, stream rpc.WebApi_SubscribeAppSessionDisputeServer) error { - sessionID := request.SessionId - s.appSessionCallbackMapLock.Lock() - callback := s.appSessionCallbackMap[sessionID] - s.appSessionCallbackMapLock.Unlock() - for { - seqNum := <-callback.seqNumChan - err := stream.Send(&rpc.DisputeInfo{ - SessionId: sessionID, - SeqNum: uint64(seqNum), - }) - if err != nil { - return err - } - } -} - -func (s *ApiServer) SignOutgoingState( - context context.Context, request *rpc.SignOutgoingStateRequest) (*rpc.SignedState, error) { - session := s.getAppSession(request.SessionId) - signed, err := session.SignAppData(request.State) - if err != nil { - return nil, err - } - return &rpc.SignedState{SignedState: signed}, nil -} - -func (s *ApiServer) ValidateAck( - context context.Context, request *rpc.ValidateAckRequest) (*rpc.BoolValue, error) { - session := s.getAppSession(request.SessionId) - _, err := session.HandleMatchData(celersdk.OPCODE_ACK, request.Envelope) - valid := true - if err != nil { - valid = false - } - return &rpc.BoolValue{Value: valid}, nil -} - -func (s *ApiServer) ProcessReceivedState( - context context.Context, - request *rpc.ProcessReceivedStateRequest) (*rpc.ProcessReceivedStateResponse, error) { - session := s.getAppSession(request.SessionId) - appData, err := session.HandleMatchData(celersdk.OPCODE_NEWSTATE, request.Envelope) - if err != nil { - return nil, err - } - return &rpc.ProcessReceivedStateResponse{ - DecodedState: appData.Received, PreparedAck: appData.AckMsg}, nil -} - func (s *ApiServer) SignData(context context.Context, request *rpc.Data) (*rpc.Signature, error) { signature, err := s.apiClient.SignData(request.Data) if err != nil { @@ -861,77 +767,22 @@ func (s *ApiServer) SignData(context context.Context, request *rpc.Data) (*rpc.S return &rpc.Signature{Signature: signature}, nil } -func (s *ApiServer) SettleAppSession( - context context.Context, - request *rpc.SettleAppSessionRequest) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.SwitchToOnchain(request.StateProof) - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (s *ApiServer) SettleAppSessionBySigTimeout( - context context.Context, - request *rpc.SettleAppSessionByTimeoutRequest) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.SettleBySigTimeout(request.OracleProof) - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (s *ApiServer) SettleAppSessionByMoveTimeout( - context context.Context, - request *rpc.SettleAppSessionByTimeoutRequest) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.SettleByMoveTimeout(request.OracleProof) - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (s *ApiServer) SettleAppSessionByInvalidTurn( - context context.Context, - request *rpc.SettleAppSessionByInvalidityRequest) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.SettleByInvalidTurn(request.OracleProof, request.CosignedStateProof) - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (s *ApiServer) SettleAppSessionByInvalidState( - context context.Context, - request *rpc.SettleAppSessionByInvalidityRequest) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.SettleByInvalidState(request.OracleProof, request.CosignedStateProof) - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - func (s *ApiServer) DeleteAppSession( context context.Context, request *rpc.SessionID) (*empty.Empty, error) { sessionID := request.SessionId - err := s.apiClient.EndAppSession(sessionID) - if err != nil { - return nil, err - } + s.apiClient.EndAppSession(sessionID) s.appSessionMapLock.Lock() - s.appSessionMap[sessionID] = nil + delete(s.appSessionMap, sessionID) s.appSessionMapLock.Unlock() return &empty.Empty{}, nil } func (s *ApiServer) GetDeployedAddressForAppSession( context context.Context, request *rpc.SessionID) (*rpc.Address, error) { - session := s.getAppSession(request.SessionId) + session, err := s.getAppSession(request.SessionId) + if err != nil { + return nil, err + } address, err := session.GetDeployedAddress() if err != nil { return nil, err @@ -942,83 +793,15 @@ func (s *ApiServer) GetDeployedAddressForAppSession( func (s *ApiServer) GetBooleanOutcomeForAppSession( context context.Context, request *rpc.GetBooleanOutcomeForAppSessionRequest) (*rpc.BooleanOutcome, error) { - session := s.getAppSession(request.SessionId) - res, err := session.OnChainGetBooleanOutcome(request.Query) - if err != nil { - return nil, err - } - return &rpc.BooleanOutcome{Finalized: res.Finalized, Outcome: res.Outcome}, nil -} - -func (s *ApiServer) ApplyActionForAppSession( - context context.Context, request *rpc.ApplyActionForAppSessionRequest) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.OnChainApplyAction(request.Action) - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (s *ApiServer) FinalizeOnActionTimeoutForAppSession( - context context.Context, request *rpc.SessionID) (*empty.Empty, error) { - session := s.getAppSession(request.SessionId) - err := session.OnChainFinalizeOnActionTimeout() - if err != nil { - return nil, err - } - return &empty.Empty{}, nil -} - -func (s *ApiServer) GetSettleFinalizedTimeForAppSession( - context context.Context, request *rpc.SessionID) (*rpc.BlockNumber, error) { - session := s.getAppSession(request.SessionId) - time, err := session.OnChainGetSettleFinalizedTime() - if err != nil { - return nil, err - } - return &rpc.BlockNumber{BlockNumber: uint64(time)}, nil -} - -func (s *ApiServer) GetActionDeadlineForAppSession( - context context.Context, request *rpc.SessionID) (*rpc.BlockNumber, error) { - session := s.getAppSession(request.SessionId) - deadline, err := session.OnChainGetActionDeadline() + session, err := s.getAppSession(request.SessionId) if err != nil { return nil, err } - return &rpc.BlockNumber{BlockNumber: uint64(deadline)}, err -} - -func (s *ApiServer) GetStatusForAppSession( - context context.Context, request *rpc.SessionID) (*rpc.AppSessionStatus, error) { - session := s.getAppSession(request.SessionId) - status, err := session.OnChainGetStatus() - if err != nil { - return nil, err - } - return &rpc.AppSessionStatus{Status: uint32(status)}, err -} - -func (s *ApiServer) GetStateForAppSession( - context context.Context, - request *rpc.GetStateForAppSessionRequest) (*rpc.AppSessionState, error) { - session := s.getAppSession(request.SessionId) - state, err := session.OnChainGetState(request.Key) - if err != nil { - return nil, err - } - return &rpc.AppSessionState{State: state}, nil -} - -func (s *ApiServer) GetSeqNumForAppSession( - context context.Context, request *rpc.SessionID) (*rpc.AppSessionSeqNum, error) { - session := s.getAppSession(request.SessionId) - seqNum, err := session.OnChainGetSeqNum() + res, err := session.OnChainGetBooleanOutcome(request.Query) if err != nil { return nil, err } - return &rpc.AppSessionSeqNum{SeqNum: uint64(seqNum)}, err + return &rpc.BooleanOutcome{Finalized: res.Finalized, Outcome: res.Outcome}, nil } func (s *ApiServer) GetBlockNumber( @@ -1031,11 +814,14 @@ func (s *ApiServer) SetMsgDropper(context context.Context, req *rpc.SetMsgDropRe return new(empty.Empty), nil } -func (s *ApiServer) getAppSession(sessionID string) *celersdk.AppSession { +func (s *ApiServer) getAppSession(sessionID string) (*celersdk.AppSession, error) { s.appSessionMapLock.Lock() - session := s.appSessionMap[sessionID] + session, ok := s.appSessionMap[sessionID] s.appSessionMapLock.Unlock() - return session + if !ok || session == nil { + return nil, status.Errorf(codes.NotFound, "app session %q not found", sessionID) + } + return session, nil } func stripPort(hostport string) string { diff --git a/webapi/api_server_test.go b/webapi/api_server_test.go new file mode 100644 index 0000000..be131b8 --- /dev/null +++ b/webapi/api_server_test.go @@ -0,0 +1,77 @@ +// Copyright 2018-2025 Celer Network + +package webapi + +import ( + "context" + "testing" + + "github.com/celer-network/agent-pay/celersdk" + "github.com/celer-network/agent-pay/webapi/rpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func TestGetAppSessionUnknownID(t *testing.T) { + s := &ApiServer{ + appSessionMap: make(map[string]*celersdk.AppSession), + } + _, err := s.getAppSession("never-created") + if status.Code(err) != codes.NotFound { + t.Fatalf("getAppSession(unknown) error code = %v, want %v (err=%v)", + status.Code(err), codes.NotFound, err) + } +} + +func TestGetAppSessionAfterDelete(t *testing.T) { + s := &ApiServer{ + appSessionMap: make(map[string]*celersdk.AppSession), + } + // Inject a non-nil session-like sentinel so the "exists then deleted" path + // uses the same map shape DeleteAppSession produces. + s.appSessionMap["sid"] = &celersdk.AppSession{ID: "sid"} + got, err := s.getAppSession("sid") + if err != nil || got == nil { + t.Fatalf("getAppSession(sid) before delete returned (%v, %v); want non-nil session", got, err) + } + + // Mirror what DeleteAppSession does to the map (the apiClient.EndAppSession + // half is bypassed here because the test stub doesn't have one). + delete(s.appSessionMap, "sid") + + _, err = s.getAppSession("sid") + if status.Code(err) != codes.NotFound { + t.Fatalf("getAppSession(sid) after delete error code = %v, want %v (err=%v)", + status.Code(err), codes.NotFound, err) + } +} + +// Public-handler regression: a query for an unknown session ID must return +// codes.NotFound at the gRPC surface (rather than nil-deref panicking, the +// pre-fix behavior). Exercises the actual surviving handlers, not just the +// helper they delegate to. +func TestGetDeployedAddressForAppSessionUnknownID(t *testing.T) { + s := &ApiServer{ + appSessionMap: make(map[string]*celersdk.AppSession), + } + _, err := s.GetDeployedAddressForAppSession( + context.Background(), + &rpc.SessionID{SessionId: "never-created"}) + if status.Code(err) != codes.NotFound { + t.Fatalf("GetDeployedAddressForAppSession(unknown) error code = %v, want %v (err=%v)", + status.Code(err), codes.NotFound, err) + } +} + +func TestGetBooleanOutcomeForAppSessionUnknownID(t *testing.T) { + s := &ApiServer{ + appSessionMap: make(map[string]*celersdk.AppSession), + } + _, err := s.GetBooleanOutcomeForAppSession( + context.Background(), + &rpc.GetBooleanOutcomeForAppSessionRequest{SessionId: "never-created"}) + if status.Code(err) != codes.NotFound { + t.Fatalf("GetBooleanOutcomeForAppSession(unknown) error code = %v, want %v (err=%v)", + status.Code(err), codes.NotFound, err) + } +} diff --git a/webapi/osp_pay_api_server.go b/webapi/osp_pay_api_server.go index 466ed10..4e1778f 100644 --- a/webapi/osp_pay_api_server.go +++ b/webapi/osp_pay_api_server.go @@ -17,7 +17,6 @@ type OspPayBackend interface { SendConditionalPayment(*rpc.SendConditionalPaymentRequest) (ctype.PayIDType, error) CreateAppSessionOnVirtualContract(*rpc.CreateAppSessionOnVirtualContractRequest) (string, error) DeleteAppSession(string) error - GetStatusForAppSession(string) (uint8, error) GetIncomingPaymentState(ctype.PayIDType) (int, error) GetIncomingPaymentRecord(ctype.PayIDType) (*PaymentRecord, error) GetOutgoingPaymentState(ctype.PayIDType) (int, error) @@ -86,16 +85,6 @@ func (s *OspPayApiServer) DeleteAppSession( return &emptypb.Empty{}, nil } -func (s *OspPayApiServer) GetStatusForAppSession( - context context.Context, - request *rpc.SessionID) (*rpc.AppSessionStatus, error) { - statusValue, err := s.backend.GetStatusForAppSession(request.GetSessionId()) - if err != nil { - return nil, err - } - return &rpc.AppSessionStatus{Status: uint32(statusValue)}, nil -} - func (s *OspPayApiServer) GetIncomingPaymentStatus( context context.Context, request *rpc.PaymentID) (*rpc.PaymentStatus, error) { diff --git a/webapi/osp_pay_api_server_test.go b/webapi/osp_pay_api_server_test.go index 2843551..a56e797 100644 --- a/webapi/osp_pay_api_server_test.go +++ b/webapi/osp_pay_api_server_test.go @@ -17,9 +17,6 @@ type stubOspPayBackend struct { createErr error deleteSessionID string deleteErr error - statusSessionID string - statusValue uint8 - statusErr error } func (*stubOspPayBackend) SendToken(*rpc.SendTokenRequest) (ctype.PayIDType, error) { @@ -40,11 +37,6 @@ func (b *stubOspPayBackend) DeleteAppSession(sessionID string) error { return b.deleteErr } -func (b *stubOspPayBackend) GetStatusForAppSession(sessionID string) (uint8, error) { - b.statusSessionID = sessionID - return b.statusValue, b.statusErr -} - func (*stubOspPayBackend) GetIncomingPaymentState(ctype.PayIDType) (int, error) { return 0, nil } @@ -68,7 +60,7 @@ func (*stubOspPayBackend) RejectIncomingPayment(ctype.PayIDType) error { func TestOspPayApiServerCreateAppSessionOnVirtualContract(t *testing.T) { backend := &stubOspPayBackend{createSessionID: "session-123"} server := NewOspPayApiServer(backend, nil) - request := &rpc.CreateAppSessionOnVirtualContractRequest{ContractBin: "beef", ContractConstructor: "cafe", Nonce: 7, OnChainTimeout: 8} + request := &rpc.CreateAppSessionOnVirtualContractRequest{ContractBin: "beef", ContractConstructor: "cafe", Nonce: 7} response, err := server.CreateAppSessionOnVirtualContract(context.Background(), request) if err != nil { @@ -82,22 +74,6 @@ func TestOspPayApiServerCreateAppSessionOnVirtualContract(t *testing.T) { } } -func TestOspPayApiServerGetStatusForAppSession(t *testing.T) { - backend := &stubOspPayBackend{statusValue: 3} - server := NewOspPayApiServer(backend, nil) - - response, err := server.GetStatusForAppSession(context.Background(), &rpc.SessionID{SessionId: "session-123"}) - if err != nil { - t.Fatal(err) - } - if response.GetStatus() != uint32(backend.statusValue) { - t.Fatalf("GetStatusForAppSession status = %d, want %d", response.GetStatus(), backend.statusValue) - } - if backend.statusSessionID != "session-123" { - t.Fatalf("GetStatusForAppSession session_id = %q, want %q", backend.statusSessionID, "session-123") - } -} - func TestOspPayApiServerDeleteAppSession(t *testing.T) { backend := &stubOspPayBackend{} server := NewOspPayApiServer(backend, nil) diff --git a/webapi/proto/web_api.proto b/webapi/proto/web_api.proto index 9344b94..cb08b54 100644 --- a/webapi/proto/web_api.proto +++ b/webapi/proto/web_api.proto @@ -120,65 +120,12 @@ message CreateAppSessionOnVirtualContractRequest { string contract_bin = 1; string contract_constructor = 2; uint64 nonce = 3; - uint64 on_chain_timeout = 4; } -message CreateAppSessionOnDeployedContractRequest { - string contract_address = 1; - uint64 nonce = 2; - uint64 on_chain_timeout = 3; - repeated string participants = 4; -} - -message DisputeInfo { - string session_id = 1; - uint64 seq_num = 2; -} - -message SignOutgoingStateRequest { - string session_id = 1; - bytes state = 2; -} - -message SignedState { bytes signed_state = 1; } - message Data { bytes data = 1; } message Signature { bytes signature = 1; } -message ValidateAckRequest { - string session_id = 1; - bytes envelope = 2; -} - -message BoolValue { bool value = 1; } - -message ProcessReceivedStateRequest { - string session_id = 1; - bytes envelope = 2; -} - -message ProcessReceivedStateResponse { - bytes decoded_state = 1; - bytes prepared_ack = 2; -} - -message SettleAppSessionRequest { - string session_id = 1; - bytes state_proof = 2; -} - -message SettleAppSessionByTimeoutRequest { - string session_id = 1; - bytes oracle_proof = 2; -} - -message SettleAppSessionByInvalidityRequest { - string session_id = 1; - bytes oracle_proof = 2; - bytes cosigned_state_proof = 3; -} - message Address { string address = 1; } message GetBooleanOutcomeForAppSessionRequest { @@ -191,23 +138,8 @@ message BooleanOutcome { bool outcome = 2; } -message ApplyActionForAppSessionRequest { - string session_id = 1; - bytes action = 2; -} - message BlockNumber { uint64 block_number = 1; } - -message AppSessionStatus { uint32 status = 1; } - -message GetStateForAppSessionRequest { - string session_id = 1; - int64 key = 2; -} - -message AppSessionState { bytes state = 1; } - -message AppSessionSeqNum { uint64 seq_num = 1; } +message Timestamp { uint64 timestamp = 1; } message SetMsgDropReq { bool drop_recv = 1; @@ -279,7 +211,7 @@ service WebApi { rpc IntendSettlePaymentChannel(TokenInfo) returns (google.protobuf.Empty) {} rpc ConfirmSettlePaymentChannel(TokenInfo) returns (google.protobuf.Empty) {} - rpc GetSettleFinalizedTimeForPaymentChannel(TokenInfo) returns (BlockNumber) {} + rpc GetSettleFinalizedTimeForPaymentChannel(TokenInfo) returns (Timestamp) {} rpc SyncOnChainPaymentChannelStatus(TokenInfo) returns (google.protobuf.Empty) {} @@ -287,38 +219,11 @@ service WebApi { rpc CreateAppSessionOnVirtualContract( CreateAppSessionOnVirtualContractRequest) returns (SessionID) {} - rpc CreateAppSessionOnDeployedContract( - CreateAppSessionOnDeployedContractRequest) returns (SessionID) {} - rpc SubscribeAppSessionDispute(SessionID) returns (stream DisputeInfo) {} - rpc SignOutgoingState(SignOutgoingStateRequest) returns (SignedState) {} - rpc ValidateAck(ValidateAckRequest) returns (BoolValue) {} rpc SignData(Data) returns (Signature) {} - rpc ProcessReceivedState(ProcessReceivedStateRequest) - returns (ProcessReceivedStateResponse) {} - rpc SettleAppSession(SettleAppSessionRequest) - returns (google.protobuf.Empty) {} - rpc SettleAppSessionBySigTimeout(SettleAppSessionByTimeoutRequest) - returns (google.protobuf.Empty) {} - rpc SettleAppSessionByMoveTimeout(SettleAppSessionByTimeoutRequest) - returns (google.protobuf.Empty) {} - rpc SettleAppSessionByInvalidTurn(SettleAppSessionByInvalidityRequest) - returns (google.protobuf.Empty) {} - rpc SettleAppSessionByInvalidState(SettleAppSessionByInvalidityRequest) - returns (google.protobuf.Empty) {} rpc DeleteAppSession(SessionID) returns (google.protobuf.Empty) {} rpc GetDeployedAddressForAppSession(SessionID) returns (Address) {} rpc GetBooleanOutcomeForAppSession(GetBooleanOutcomeForAppSessionRequest) returns (BooleanOutcome) {} - rpc ApplyActionForAppSession(ApplyActionForAppSessionRequest) - returns (google.protobuf.Empty) {} - rpc FinalizeOnActionTimeoutForAppSession(SessionID) - returns (google.protobuf.Empty) {} - rpc GetSettleFinalizedTimeForAppSession(SessionID) returns (BlockNumber) {} - rpc GetActionDeadlineForAppSession(SessionID) returns (BlockNumber) {} - rpc GetStatusForAppSession(SessionID) returns (AppSessionStatus) {} - rpc GetStateForAppSession(GetStateForAppSessionRequest) - returns (AppSessionState) {} - rpc GetSeqNumForAppSession(SessionID) returns (AppSessionSeqNum) {} rpc GetBlockNumber(google.protobuf.Empty) returns (BlockNumber) {} rpc SetMsgDropper(SetMsgDropReq) returns (google.protobuf.Empty) {} diff --git a/webapi/rpc/web_api.pb.go b/webapi/rpc/web_api.pb.go index ea10b70..875273c 100644 --- a/webapi/rpc/web_api.pb.go +++ b/webapi/rpc/web_api.pb.go @@ -1136,7 +1136,6 @@ type CreateAppSessionOnVirtualContractRequest struct { ContractBin string `protobuf:"bytes,1,opt,name=contract_bin,json=contractBin,proto3" json:"contract_bin,omitempty"` ContractConstructor string `protobuf:"bytes,2,opt,name=contract_constructor,json=contractConstructor,proto3" json:"contract_constructor,omitempty"` Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` - OnChainTimeout uint64 `protobuf:"varint,4,opt,name=on_chain_timeout,json=onChainTimeout,proto3" json:"on_chain_timeout,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1192,540 +1191,28 @@ func (x *CreateAppSessionOnVirtualContractRequest) GetNonce() uint64 { return 0 } -func (x *CreateAppSessionOnVirtualContractRequest) GetOnChainTimeout() uint64 { - if x != nil { - return x.OnChainTimeout - } - return 0 -} - -type CreateAppSessionOnDeployedContractRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` - OnChainTimeout uint64 `protobuf:"varint,3,opt,name=on_chain_timeout,json=onChainTimeout,proto3" json:"on_chain_timeout,omitempty"` - Participants []string `protobuf:"bytes,4,rep,name=participants,proto3" json:"participants,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CreateAppSessionOnDeployedContractRequest) Reset() { - *x = CreateAppSessionOnDeployedContractRequest{} - mi := &file_web_api_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CreateAppSessionOnDeployedContractRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateAppSessionOnDeployedContractRequest) ProtoMessage() {} - -func (x *CreateAppSessionOnDeployedContractRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateAppSessionOnDeployedContractRequest.ProtoReflect.Descriptor instead. -func (*CreateAppSessionOnDeployedContractRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{20} -} - -func (x *CreateAppSessionOnDeployedContractRequest) GetContractAddress() string { - if x != nil { - return x.ContractAddress - } - return "" -} - -func (x *CreateAppSessionOnDeployedContractRequest) GetNonce() uint64 { - if x != nil { - return x.Nonce - } - return 0 -} - -func (x *CreateAppSessionOnDeployedContractRequest) GetOnChainTimeout() uint64 { - if x != nil { - return x.OnChainTimeout - } - return 0 -} - -func (x *CreateAppSessionOnDeployedContractRequest) GetParticipants() []string { - if x != nil { - return x.Participants - } - return nil -} - -type DisputeInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - SeqNum uint64 `protobuf:"varint,2,opt,name=seq_num,json=seqNum,proto3" json:"seq_num,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DisputeInfo) Reset() { - *x = DisputeInfo{} - mi := &file_web_api_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DisputeInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DisputeInfo) ProtoMessage() {} - -func (x *DisputeInfo) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DisputeInfo.ProtoReflect.Descriptor instead. -func (*DisputeInfo) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{21} -} - -func (x *DisputeInfo) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *DisputeInfo) GetSeqNum() uint64 { - if x != nil { - return x.SeqNum - } - return 0 -} - -type SignOutgoingStateRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - State []byte `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SignOutgoingStateRequest) Reset() { - *x = SignOutgoingStateRequest{} - mi := &file_web_api_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SignOutgoingStateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SignOutgoingStateRequest) ProtoMessage() {} - -func (x *SignOutgoingStateRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SignOutgoingStateRequest.ProtoReflect.Descriptor instead. -func (*SignOutgoingStateRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{22} -} - -func (x *SignOutgoingStateRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *SignOutgoingStateRequest) GetState() []byte { - if x != nil { - return x.State - } - return nil -} - -type SignedState struct { - state protoimpl.MessageState `protogen:"open.v1"` - SignedState []byte `protobuf:"bytes,1,opt,name=signed_state,json=signedState,proto3" json:"signed_state,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SignedState) Reset() { - *x = SignedState{} - mi := &file_web_api_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SignedState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SignedState) ProtoMessage() {} - -func (x *SignedState) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SignedState.ProtoReflect.Descriptor instead. -func (*SignedState) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{23} -} - -func (x *SignedState) GetSignedState() []byte { - if x != nil { - return x.SignedState - } - return nil -} - -type Data struct { - state protoimpl.MessageState `protogen:"open.v1"` - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Data) Reset() { - *x = Data{} - mi := &file_web_api_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Data) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data) ProtoMessage() {} - -func (x *Data) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data.ProtoReflect.Descriptor instead. -func (*Data) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{24} -} - -func (x *Data) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -type Signature struct { - state protoimpl.MessageState `protogen:"open.v1"` - Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Signature) Reset() { - *x = Signature{} - mi := &file_web_api_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Signature) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Signature) ProtoMessage() {} - -func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Signature.ProtoReflect.Descriptor instead. -func (*Signature) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{25} -} - -func (x *Signature) GetSignature() []byte { - if x != nil { - return x.Signature - } - return nil -} - -type ValidateAckRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Envelope []byte `protobuf:"bytes,2,opt,name=envelope,proto3" json:"envelope,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ValidateAckRequest) Reset() { - *x = ValidateAckRequest{} - mi := &file_web_api_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ValidateAckRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValidateAckRequest) ProtoMessage() {} - -func (x *ValidateAckRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ValidateAckRequest.ProtoReflect.Descriptor instead. -func (*ValidateAckRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{26} -} - -func (x *ValidateAckRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *ValidateAckRequest) GetEnvelope() []byte { - if x != nil { - return x.Envelope - } - return nil -} - -type BoolValue struct { - state protoimpl.MessageState `protogen:"open.v1"` - Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BoolValue) Reset() { - *x = BoolValue{} - mi := &file_web_api_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BoolValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BoolValue) ProtoMessage() {} - -func (x *BoolValue) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[27] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BoolValue.ProtoReflect.Descriptor instead. -func (*BoolValue) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{27} -} - -func (x *BoolValue) GetValue() bool { - if x != nil { - return x.Value - } - return false -} - -type ProcessReceivedStateRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Envelope []byte `protobuf:"bytes,2,opt,name=envelope,proto3" json:"envelope,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProcessReceivedStateRequest) Reset() { - *x = ProcessReceivedStateRequest{} - mi := &file_web_api_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProcessReceivedStateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProcessReceivedStateRequest) ProtoMessage() {} - -func (x *ProcessReceivedStateRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[28] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProcessReceivedStateRequest.ProtoReflect.Descriptor instead. -func (*ProcessReceivedStateRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{28} -} - -func (x *ProcessReceivedStateRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *ProcessReceivedStateRequest) GetEnvelope() []byte { - if x != nil { - return x.Envelope - } - return nil -} - -type ProcessReceivedStateResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - DecodedState []byte `protobuf:"bytes,1,opt,name=decoded_state,json=decodedState,proto3" json:"decoded_state,omitempty"` - PreparedAck []byte `protobuf:"bytes,2,opt,name=prepared_ack,json=preparedAck,proto3" json:"prepared_ack,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ProcessReceivedStateResponse) Reset() { - *x = ProcessReceivedStateResponse{} - mi := &file_web_api_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ProcessReceivedStateResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProcessReceivedStateResponse) ProtoMessage() {} - -func (x *ProcessReceivedStateResponse) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[29] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProcessReceivedStateResponse.ProtoReflect.Descriptor instead. -func (*ProcessReceivedStateResponse) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{29} -} - -func (x *ProcessReceivedStateResponse) GetDecodedState() []byte { - if x != nil { - return x.DecodedState - } - return nil -} - -func (x *ProcessReceivedStateResponse) GetPreparedAck() []byte { - if x != nil { - return x.PreparedAck - } - return nil -} - -type SettleAppSessionRequest struct { +type Data struct { state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - StateProof []byte `protobuf:"bytes,2,opt,name=state_proof,json=stateProof,proto3" json:"state_proof,omitempty"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *SettleAppSessionRequest) Reset() { - *x = SettleAppSessionRequest{} - mi := &file_web_api_proto_msgTypes[30] +func (x *Data) Reset() { + *x = Data{} + mi := &file_web_api_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SettleAppSessionRequest) String() string { +func (x *Data) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettleAppSessionRequest) ProtoMessage() {} +func (*Data) ProtoMessage() {} -func (x *SettleAppSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[30] +func (x *Data) ProtoReflect() protoreflect.Message { + mi := &file_web_api_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1736,101 +1223,40 @@ func (x *SettleAppSessionRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettleAppSessionRequest.ProtoReflect.Descriptor instead. -func (*SettleAppSessionRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{30} -} - -func (x *SettleAppSessionRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" +// Deprecated: Use Data.ProtoReflect.Descriptor instead. +func (*Data) Descriptor() ([]byte, []int) { + return file_web_api_proto_rawDescGZIP(), []int{20} } -func (x *SettleAppSessionRequest) GetStateProof() []byte { +func (x *Data) GetData() []byte { if x != nil { - return x.StateProof + return x.Data } return nil } -type SettleAppSessionByTimeoutRequest struct { +type Signature struct { state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - OracleProof []byte `protobuf:"bytes,2,opt,name=oracle_proof,json=oracleProof,proto3" json:"oracle_proof,omitempty"` + Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *SettleAppSessionByTimeoutRequest) Reset() { - *x = SettleAppSessionByTimeoutRequest{} - mi := &file_web_api_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SettleAppSessionByTimeoutRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SettleAppSessionByTimeoutRequest) ProtoMessage() {} - -func (x *SettleAppSessionByTimeoutRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[31] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SettleAppSessionByTimeoutRequest.ProtoReflect.Descriptor instead. -func (*SettleAppSessionByTimeoutRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{31} -} - -func (x *SettleAppSessionByTimeoutRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *SettleAppSessionByTimeoutRequest) GetOracleProof() []byte { - if x != nil { - return x.OracleProof - } - return nil -} - -type SettleAppSessionByInvalidityRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - OracleProof []byte `protobuf:"bytes,2,opt,name=oracle_proof,json=oracleProof,proto3" json:"oracle_proof,omitempty"` - CosignedStateProof []byte `protobuf:"bytes,3,opt,name=cosigned_state_proof,json=cosignedStateProof,proto3" json:"cosigned_state_proof,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SettleAppSessionByInvalidityRequest) Reset() { - *x = SettleAppSessionByInvalidityRequest{} - mi := &file_web_api_proto_msgTypes[32] +func (x *Signature) Reset() { + *x = Signature{} + mi := &file_web_api_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SettleAppSessionByInvalidityRequest) String() string { +func (x *Signature) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettleAppSessionByInvalidityRequest) ProtoMessage() {} +func (*Signature) ProtoMessage() {} -func (x *SettleAppSessionByInvalidityRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[32] +func (x *Signature) ProtoReflect() protoreflect.Message { + mi := &file_web_api_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1841,28 +1267,14 @@ func (x *SettleAppSessionByInvalidityRequest) ProtoReflect() protoreflect.Messag return mi.MessageOf(x) } -// Deprecated: Use SettleAppSessionByInvalidityRequest.ProtoReflect.Descriptor instead. -func (*SettleAppSessionByInvalidityRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{32} -} - -func (x *SettleAppSessionByInvalidityRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *SettleAppSessionByInvalidityRequest) GetOracleProof() []byte { - if x != nil { - return x.OracleProof - } - return nil +// Deprecated: Use Signature.ProtoReflect.Descriptor instead. +func (*Signature) Descriptor() ([]byte, []int) { + return file_web_api_proto_rawDescGZIP(), []int{21} } -func (x *SettleAppSessionByInvalidityRequest) GetCosignedStateProof() []byte { +func (x *Signature) GetSignature() []byte { if x != nil { - return x.CosignedStateProof + return x.Signature } return nil } @@ -1876,7 +1288,7 @@ type Address struct { func (x *Address) Reset() { *x = Address{} - mi := &file_web_api_proto_msgTypes[33] + mi := &file_web_api_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1888,7 +1300,7 @@ func (x *Address) String() string { func (*Address) ProtoMessage() {} func (x *Address) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[33] + mi := &file_web_api_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1901,7 +1313,7 @@ func (x *Address) ProtoReflect() protoreflect.Message { // Deprecated: Use Address.ProtoReflect.Descriptor instead. func (*Address) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{33} + return file_web_api_proto_rawDescGZIP(), []int{22} } func (x *Address) GetAddress() string { @@ -1921,7 +1333,7 @@ type GetBooleanOutcomeForAppSessionRequest struct { func (x *GetBooleanOutcomeForAppSessionRequest) Reset() { *x = GetBooleanOutcomeForAppSessionRequest{} - mi := &file_web_api_proto_msgTypes[34] + mi := &file_web_api_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1933,7 +1345,7 @@ func (x *GetBooleanOutcomeForAppSessionRequest) String() string { func (*GetBooleanOutcomeForAppSessionRequest) ProtoMessage() {} func (x *GetBooleanOutcomeForAppSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[34] + mi := &file_web_api_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1946,7 +1358,7 @@ func (x *GetBooleanOutcomeForAppSessionRequest) ProtoReflect() protoreflect.Mess // Deprecated: Use GetBooleanOutcomeForAppSessionRequest.ProtoReflect.Descriptor instead. func (*GetBooleanOutcomeForAppSessionRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{34} + return file_web_api_proto_rawDescGZIP(), []int{23} } func (x *GetBooleanOutcomeForAppSessionRequest) GetSessionId() string { @@ -1973,7 +1385,7 @@ type BooleanOutcome struct { func (x *BooleanOutcome) Reset() { *x = BooleanOutcome{} - mi := &file_web_api_proto_msgTypes[35] + mi := &file_web_api_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1985,7 +1397,7 @@ func (x *BooleanOutcome) String() string { func (*BooleanOutcome) ProtoMessage() {} func (x *BooleanOutcome) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[35] + mi := &file_web_api_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1998,7 +1410,7 @@ func (x *BooleanOutcome) ProtoReflect() protoreflect.Message { // Deprecated: Use BooleanOutcome.ProtoReflect.Descriptor instead. func (*BooleanOutcome) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{35} + return file_web_api_proto_rawDescGZIP(), []int{24} } func (x *BooleanOutcome) GetFinalized() bool { @@ -2015,58 +1427,6 @@ func (x *BooleanOutcome) GetOutcome() bool { return false } -type ApplyActionForAppSessionRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Action []byte `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ApplyActionForAppSessionRequest) Reset() { - *x = ApplyActionForAppSessionRequest{} - mi := &file_web_api_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ApplyActionForAppSessionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ApplyActionForAppSessionRequest) ProtoMessage() {} - -func (x *ApplyActionForAppSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[36] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ApplyActionForAppSessionRequest.ProtoReflect.Descriptor instead. -func (*ApplyActionForAppSessionRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{36} -} - -func (x *ApplyActionForAppSessionRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *ApplyActionForAppSessionRequest) GetAction() []byte { - if x != nil { - return x.Action - } - return nil -} - type BlockNumber struct { state protoimpl.MessageState `protogen:"open.v1"` BlockNumber uint64 `protobuf:"varint,1,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` @@ -2076,7 +1436,7 @@ type BlockNumber struct { func (x *BlockNumber) Reset() { *x = BlockNumber{} - mi := &file_web_api_proto_msgTypes[37] + mi := &file_web_api_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2088,7 +1448,7 @@ func (x *BlockNumber) String() string { func (*BlockNumber) ProtoMessage() {} func (x *BlockNumber) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[37] + mi := &file_web_api_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2101,7 +1461,7 @@ func (x *BlockNumber) ProtoReflect() protoreflect.Message { // Deprecated: Use BlockNumber.ProtoReflect.Descriptor instead. func (*BlockNumber) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{37} + return file_web_api_proto_rawDescGZIP(), []int{25} } func (x *BlockNumber) GetBlockNumber() uint64 { @@ -2111,168 +1471,28 @@ func (x *BlockNumber) GetBlockNumber() uint64 { return 0 } -type AppSessionStatus struct { - state protoimpl.MessageState `protogen:"open.v1"` - Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AppSessionStatus) Reset() { - *x = AppSessionStatus{} - mi := &file_web_api_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AppSessionStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppSessionStatus) ProtoMessage() {} - -func (x *AppSessionStatus) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[38] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AppSessionStatus.ProtoReflect.Descriptor instead. -func (*AppSessionStatus) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{38} -} - -func (x *AppSessionStatus) GetStatus() uint32 { - if x != nil { - return x.Status - } - return 0 -} - -type GetStateForAppSessionRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Key int64 `protobuf:"varint,2,opt,name=key,proto3" json:"key,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetStateForAppSessionRequest) Reset() { - *x = GetStateForAppSessionRequest{} - mi := &file_web_api_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetStateForAppSessionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetStateForAppSessionRequest) ProtoMessage() {} - -func (x *GetStateForAppSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[39] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetStateForAppSessionRequest.ProtoReflect.Descriptor instead. -func (*GetStateForAppSessionRequest) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{39} -} - -func (x *GetStateForAppSessionRequest) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *GetStateForAppSessionRequest) GetKey() int64 { - if x != nil { - return x.Key - } - return 0 -} - -type AppSessionState struct { - state protoimpl.MessageState `protogen:"open.v1"` - State []byte `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AppSessionState) Reset() { - *x = AppSessionState{} - mi := &file_web_api_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AppSessionState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppSessionState) ProtoMessage() {} - -func (x *AppSessionState) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[40] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AppSessionState.ProtoReflect.Descriptor instead. -func (*AppSessionState) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{40} -} - -func (x *AppSessionState) GetState() []byte { - if x != nil { - return x.State - } - return nil -} - -type AppSessionSeqNum struct { +type Timestamp struct { state protoimpl.MessageState `protogen:"open.v1"` - SeqNum uint64 `protobuf:"varint,1,opt,name=seq_num,json=seqNum,proto3" json:"seq_num,omitempty"` + Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *AppSessionSeqNum) Reset() { - *x = AppSessionSeqNum{} - mi := &file_web_api_proto_msgTypes[41] +func (x *Timestamp) Reset() { + *x = Timestamp{} + mi := &file_web_api_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *AppSessionSeqNum) String() string { +func (x *Timestamp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*AppSessionSeqNum) ProtoMessage() {} +func (*Timestamp) ProtoMessage() {} -func (x *AppSessionSeqNum) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[41] +func (x *Timestamp) ProtoReflect() protoreflect.Message { + mi := &file_web_api_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2283,14 +1503,14 @@ func (x *AppSessionSeqNum) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use AppSessionSeqNum.ProtoReflect.Descriptor instead. -func (*AppSessionSeqNum) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{41} +// Deprecated: Use Timestamp.ProtoReflect.Descriptor instead. +func (*Timestamp) Descriptor() ([]byte, []int) { + return file_web_api_proto_rawDescGZIP(), []int{26} } -func (x *AppSessionSeqNum) GetSeqNum() uint64 { +func (x *Timestamp) GetTimestamp() uint64 { if x != nil { - return x.SeqNum + return x.Timestamp } return 0 } @@ -2305,7 +1525,7 @@ type SetMsgDropReq struct { func (x *SetMsgDropReq) Reset() { *x = SetMsgDropReq{} - mi := &file_web_api_proto_msgTypes[42] + mi := &file_web_api_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2317,7 +1537,7 @@ func (x *SetMsgDropReq) String() string { func (*SetMsgDropReq) ProtoMessage() {} func (x *SetMsgDropReq) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[42] + mi := &file_web_api_proto_msgTypes[27] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2330,7 +1550,7 @@ func (x *SetMsgDropReq) ProtoReflect() protoreflect.Message { // Deprecated: Use SetMsgDropReq.ProtoReflect.Descriptor instead. func (*SetMsgDropReq) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{42} + return file_web_api_proto_rawDescGZIP(), []int{27} } func (x *SetMsgDropReq) GetDropRecv() bool { @@ -2356,7 +1576,7 @@ type PaymentStatus struct { func (x *PaymentStatus) Reset() { *x = PaymentStatus{} - mi := &file_web_api_proto_msgTypes[43] + mi := &file_web_api_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2368,7 +1588,7 @@ func (x *PaymentStatus) String() string { func (*PaymentStatus) ProtoMessage() {} func (x *PaymentStatus) ProtoReflect() protoreflect.Message { - mi := &file_web_api_proto_msgTypes[43] + mi := &file_web_api_proto_msgTypes[28] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2381,7 +1601,7 @@ func (x *PaymentStatus) ProtoReflect() protoreflect.Message { // Deprecated: Use PaymentStatus.ProtoReflect.Descriptor instead. func (*PaymentStatus) Descriptor() ([]byte, []int) { - return file_web_api_proto_rawDescGZIP(), []int{43} + return file_web_api_proto_rawDescGZIP(), []int{28} } func (x *PaymentStatus) GetStatus() uint32 { @@ -2484,58 +1704,15 @@ const file_web_api_proto_rawDesc = "" + "\x10resolve_deadline\x18\x02 \x01(\x04R\x0fresolveDeadline\"*\n" + "\tSessionID\x12\x1d\n" + "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\"\xc0\x01\n" + + "session_id\x18\x01 \x01(\tR\tsessionId\"\x96\x01\n" + "(CreateAppSessionOnVirtualContractRequest\x12!\n" + "\fcontract_bin\x18\x01 \x01(\tR\vcontractBin\x121\n" + "\x14contract_constructor\x18\x02 \x01(\tR\x13contractConstructor\x12\x14\n" + - "\x05nonce\x18\x03 \x01(\x04R\x05nonce\x12(\n" + - "\x10on_chain_timeout\x18\x04 \x01(\x04R\x0eonChainTimeout\"\xba\x01\n" + - ")CreateAppSessionOnDeployedContractRequest\x12)\n" + - "\x10contract_address\x18\x01 \x01(\tR\x0fcontractAddress\x12\x14\n" + - "\x05nonce\x18\x02 \x01(\x04R\x05nonce\x12(\n" + - "\x10on_chain_timeout\x18\x03 \x01(\x04R\x0eonChainTimeout\x12\"\n" + - "\fparticipants\x18\x04 \x03(\tR\fparticipants\"E\n" + - "\vDisputeInfo\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x17\n" + - "\aseq_num\x18\x02 \x01(\x04R\x06seqNum\"O\n" + - "\x18SignOutgoingStateRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x14\n" + - "\x05state\x18\x02 \x01(\fR\x05state\"0\n" + - "\vSignedState\x12!\n" + - "\fsigned_state\x18\x01 \x01(\fR\vsignedState\"\x1a\n" + + "\x05nonce\x18\x03 \x01(\x04R\x05nonce\"\x1a\n" + "\x04Data\x12\x12\n" + "\x04data\x18\x01 \x01(\fR\x04data\")\n" + "\tSignature\x12\x1c\n" + - "\tsignature\x18\x01 \x01(\fR\tsignature\"O\n" + - "\x12ValidateAckRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x1a\n" + - "\benvelope\x18\x02 \x01(\fR\benvelope\"!\n" + - "\tBoolValue\x12\x14\n" + - "\x05value\x18\x01 \x01(\bR\x05value\"X\n" + - "\x1bProcessReceivedStateRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x1a\n" + - "\benvelope\x18\x02 \x01(\fR\benvelope\"f\n" + - "\x1cProcessReceivedStateResponse\x12#\n" + - "\rdecoded_state\x18\x01 \x01(\fR\fdecodedState\x12!\n" + - "\fprepared_ack\x18\x02 \x01(\fR\vpreparedAck\"Y\n" + - "\x17SettleAppSessionRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x1f\n" + - "\vstate_proof\x18\x02 \x01(\fR\n" + - "stateProof\"d\n" + - " SettleAppSessionByTimeoutRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12!\n" + - "\foracle_proof\x18\x02 \x01(\fR\voracleProof\"\x99\x01\n" + - "#SettleAppSessionByInvalidityRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12!\n" + - "\foracle_proof\x18\x02 \x01(\fR\voracleProof\x120\n" + - "\x14cosigned_state_proof\x18\x03 \x01(\fR\x12cosignedStateProof\"#\n" + + "\tsignature\x18\x01 \x01(\fR\tsignature\"#\n" + "\aAddress\x12\x18\n" + "\aaddress\x18\x01 \x01(\tR\aaddress\"\\\n" + "%GetBooleanOutcomeForAppSessionRequest\x12\x1d\n" + @@ -2544,28 +1721,16 @@ const file_web_api_proto_rawDesc = "" + "\x05query\x18\x02 \x01(\fR\x05query\"H\n" + "\x0eBooleanOutcome\x12\x1c\n" + "\tfinalized\x18\x01 \x01(\bR\tfinalized\x12\x18\n" + - "\aoutcome\x18\x02 \x01(\bR\aoutcome\"X\n" + - "\x1fApplyActionForAppSessionRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x16\n" + - "\x06action\x18\x02 \x01(\fR\x06action\"0\n" + + "\aoutcome\x18\x02 \x01(\bR\aoutcome\"0\n" + "\vBlockNumber\x12!\n" + - "\fblock_number\x18\x01 \x01(\x04R\vblockNumber\"*\n" + - "\x10AppSessionStatus\x12\x16\n" + - "\x06status\x18\x01 \x01(\rR\x06status\"O\n" + - "\x1cGetStateForAppSessionRequest\x12\x1d\n" + - "\n" + - "session_id\x18\x01 \x01(\tR\tsessionId\x12\x10\n" + - "\x03key\x18\x02 \x01(\x03R\x03key\"'\n" + - "\x0fAppSessionState\x12\x14\n" + - "\x05state\x18\x01 \x01(\fR\x05state\"+\n" + - "\x10AppSessionSeqNum\x12\x17\n" + - "\aseq_num\x18\x01 \x01(\x04R\x06seqNum\"I\n" + + "\fblock_number\x18\x01 \x01(\x04R\vblockNumber\")\n" + + "\tTimestamp\x12\x1c\n" + + "\ttimestamp\x18\x01 \x01(\x04R\ttimestamp\"I\n" + "\rSetMsgDropReq\x12\x1b\n" + "\tdrop_recv\x18\x01 \x01(\bR\bdropRecv\x12\x1b\n" + "\tdrop_send\x18\x02 \x01(\bR\bdropSend\"'\n" + "\rPaymentStatus\x12\x16\n" + - "\x06status\x18\x01 \x01(\rR\x06status2\xa0#\n" + + "\x06status\x18\x01 \x01(\rR\x06status2\xcd\x17\n" + "\x06WebApi\x12N\n" + "\rGetPayHistory\x12\x1c.webrpc.GetPayHistoryRequest\x1a\x1d.webrpc.GetPayHistoryResponse\"\x00\x12G\n" + "\rSetDelegation\x12\x1c.webrpc.SetDelegationRequest\x1a\x16.google.protobuf.Empty\"\x00\x12L\n" + @@ -2596,32 +1761,15 @@ const file_web_api_proto_rawDesc = "" + "\x0eIntendWithdraw\x12 .webrpc.DepositOrWithdrawRequest\x1a\x16.google.protobuf.Empty\"\x00\x12>\n" + "\x0fConfirmWithdraw\x12\x11.webrpc.TokenInfo\x1a\x16.google.protobuf.Empty\"\x00\x12I\n" + "\x1aIntendSettlePaymentChannel\x12\x11.webrpc.TokenInfo\x1a\x16.google.protobuf.Empty\"\x00\x12J\n" + - "\x1bConfirmSettlePaymentChannel\x12\x11.webrpc.TokenInfo\x1a\x16.google.protobuf.Empty\"\x00\x12S\n" + - "'GetSettleFinalizedTimeForPaymentChannel\x12\x11.webrpc.TokenInfo\x1a\x13.webrpc.BlockNumber\"\x00\x12N\n" + + "\x1bConfirmSettlePaymentChannel\x12\x11.webrpc.TokenInfo\x1a\x16.google.protobuf.Empty\"\x00\x12Q\n" + + "'GetSettleFinalizedTimeForPaymentChannel\x12\x11.webrpc.TokenInfo\x1a\x11.webrpc.Timestamp\"\x00\x12N\n" + "\x1fSyncOnChainPaymentChannelStatus\x12\x11.webrpc.TokenInfo\x1a\x16.google.protobuf.Empty\"\x00\x12E\n" + "\x11SyncStateWithPeer\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\"\x00\x12j\n" + - "!CreateAppSessionOnVirtualContract\x120.webrpc.CreateAppSessionOnVirtualContractRequest\x1a\x11.webrpc.SessionID\"\x00\x12l\n" + - "\"CreateAppSessionOnDeployedContract\x121.webrpc.CreateAppSessionOnDeployedContractRequest\x1a\x11.webrpc.SessionID\"\x00\x12H\n" + - "\x1aSubscribeAppSessionDispute\x12\x11.webrpc.SessionID\x1a\x13.webrpc.DisputeInfo\"\x000\x01\x12L\n" + - "\x11SignOutgoingState\x12 .webrpc.SignOutgoingStateRequest\x1a\x13.webrpc.SignedState\"\x00\x12>\n" + - "\vValidateAck\x12\x1a.webrpc.ValidateAckRequest\x1a\x11.webrpc.BoolValue\"\x00\x12-\n" + - "\bSignData\x12\f.webrpc.Data\x1a\x11.webrpc.Signature\"\x00\x12c\n" + - "\x14ProcessReceivedState\x12#.webrpc.ProcessReceivedStateRequest\x1a$.webrpc.ProcessReceivedStateResponse\"\x00\x12M\n" + - "\x10SettleAppSession\x12\x1f.webrpc.SettleAppSessionRequest\x1a\x16.google.protobuf.Empty\"\x00\x12b\n" + - "\x1cSettleAppSessionBySigTimeout\x12(.webrpc.SettleAppSessionByTimeoutRequest\x1a\x16.google.protobuf.Empty\"\x00\x12c\n" + - "\x1dSettleAppSessionByMoveTimeout\x12(.webrpc.SettleAppSessionByTimeoutRequest\x1a\x16.google.protobuf.Empty\"\x00\x12f\n" + - "\x1dSettleAppSessionByInvalidTurn\x12+.webrpc.SettleAppSessionByInvalidityRequest\x1a\x16.google.protobuf.Empty\"\x00\x12g\n" + - "\x1eSettleAppSessionByInvalidState\x12+.webrpc.SettleAppSessionByInvalidityRequest\x1a\x16.google.protobuf.Empty\"\x00\x12?\n" + + "!CreateAppSessionOnVirtualContract\x120.webrpc.CreateAppSessionOnVirtualContractRequest\x1a\x11.webrpc.SessionID\"\x00\x12-\n" + + "\bSignData\x12\f.webrpc.Data\x1a\x11.webrpc.Signature\"\x00\x12?\n" + "\x10DeleteAppSession\x12\x11.webrpc.SessionID\x1a\x16.google.protobuf.Empty\"\x00\x12G\n" + "\x1fGetDeployedAddressForAppSession\x12\x11.webrpc.SessionID\x1a\x0f.webrpc.Address\"\x00\x12i\n" + - "\x1eGetBooleanOutcomeForAppSession\x12-.webrpc.GetBooleanOutcomeForAppSessionRequest\x1a\x16.webrpc.BooleanOutcome\"\x00\x12]\n" + - "\x18ApplyActionForAppSession\x12'.webrpc.ApplyActionForAppSessionRequest\x1a\x16.google.protobuf.Empty\"\x00\x12S\n" + - "$FinalizeOnActionTimeoutForAppSession\x12\x11.webrpc.SessionID\x1a\x16.google.protobuf.Empty\"\x00\x12O\n" + - "#GetSettleFinalizedTimeForAppSession\x12\x11.webrpc.SessionID\x1a\x13.webrpc.BlockNumber\"\x00\x12J\n" + - "\x1eGetActionDeadlineForAppSession\x12\x11.webrpc.SessionID\x1a\x13.webrpc.BlockNumber\"\x00\x12G\n" + - "\x16GetStatusForAppSession\x12\x11.webrpc.SessionID\x1a\x18.webrpc.AppSessionStatus\"\x00\x12X\n" + - "\x15GetStateForAppSession\x12$.webrpc.GetStateForAppSessionRequest\x1a\x17.webrpc.AppSessionState\"\x00\x12G\n" + - "\x16GetSeqNumForAppSession\x12\x11.webrpc.SessionID\x1a\x18.webrpc.AppSessionSeqNum\"\x00\x12?\n" + + "\x1eGetBooleanOutcomeForAppSession\x12-.webrpc.GetBooleanOutcomeForAppSessionRequest\x1a\x16.webrpc.BooleanOutcome\"\x00\x12?\n" + "\x0eGetBlockNumber\x12\x16.google.protobuf.Empty\x1a\x13.webrpc.BlockNumber\"\x00\x12@\n" + "\rSetMsgDropper\x12\x15.webrpc.SetMsgDropReq\x1a\x16.google.protobuf.Empty\"\x00B/Z-github.com/celer-network/agent-pay/webapi/rpcb\x06proto3" @@ -2637,71 +1785,56 @@ func file_web_api_proto_rawDescGZIP() []byte { return file_web_api_proto_rawDescData } -var file_web_api_proto_msgTypes = make([]protoimpl.MessageInfo, 44) +var file_web_api_proto_msgTypes = make([]protoimpl.MessageInfo, 29) var file_web_api_proto_goTypes = []any{ - (*GetPayHistoryRequest)(nil), // 0: webrpc.GetPayHistoryRequest - (*GetPayHistoryResponse)(nil), // 1: webrpc.GetPayHistoryResponse - (*TokenInfo)(nil), // 2: webrpc.TokenInfo - (*SetDelegationRequest)(nil), // 3: webrpc.SetDelegationRequest - (*OpenPaymentChannelRequest)(nil), // 4: webrpc.OpenPaymentChannelRequest - (*ChannelID)(nil), // 5: webrpc.ChannelID - (*DepositOrWithdrawRequest)(nil), // 6: webrpc.DepositOrWithdrawRequest - (*DepositOrWithdrawJob)(nil), // 7: webrpc.DepositOrWithdrawJob - (*GetBalanceResponse)(nil), // 8: webrpc.GetBalanceResponse - (*GetPeerFreeBalanceRequest)(nil), // 9: webrpc.GetPeerFreeBalanceRequest - (*FreeBalance)(nil), // 10: webrpc.FreeBalance - (*Condition)(nil), // 11: webrpc.Condition - (*SendConditionalPaymentRequest)(nil), // 12: webrpc.SendConditionalPaymentRequest - (*SendTokenRequest)(nil), // 13: webrpc.SendTokenRequest - (*PaymentID)(nil), // 14: webrpc.PaymentID - (*PaymentInfo)(nil), // 15: webrpc.PaymentInfo - (*OutgoingPaymentInfo)(nil), // 16: webrpc.OutgoingPaymentInfo - (*OnChainPaymentInfo)(nil), // 17: webrpc.OnChainPaymentInfo - (*SessionID)(nil), // 18: webrpc.SessionID - (*CreateAppSessionOnVirtualContractRequest)(nil), // 19: webrpc.CreateAppSessionOnVirtualContractRequest - (*CreateAppSessionOnDeployedContractRequest)(nil), // 20: webrpc.CreateAppSessionOnDeployedContractRequest - (*DisputeInfo)(nil), // 21: webrpc.DisputeInfo - (*SignOutgoingStateRequest)(nil), // 22: webrpc.SignOutgoingStateRequest - (*SignedState)(nil), // 23: webrpc.SignedState - (*Data)(nil), // 24: webrpc.Data - (*Signature)(nil), // 25: webrpc.Signature - (*ValidateAckRequest)(nil), // 26: webrpc.ValidateAckRequest - (*BoolValue)(nil), // 27: webrpc.BoolValue - (*ProcessReceivedStateRequest)(nil), // 28: webrpc.ProcessReceivedStateRequest - (*ProcessReceivedStateResponse)(nil), // 29: webrpc.ProcessReceivedStateResponse - (*SettleAppSessionRequest)(nil), // 30: webrpc.SettleAppSessionRequest - (*SettleAppSessionByTimeoutRequest)(nil), // 31: webrpc.SettleAppSessionByTimeoutRequest - (*SettleAppSessionByInvalidityRequest)(nil), // 32: webrpc.SettleAppSessionByInvalidityRequest - (*Address)(nil), // 33: webrpc.Address - (*GetBooleanOutcomeForAppSessionRequest)(nil), // 34: webrpc.GetBooleanOutcomeForAppSessionRequest - (*BooleanOutcome)(nil), // 35: webrpc.BooleanOutcome - (*ApplyActionForAppSessionRequest)(nil), // 36: webrpc.ApplyActionForAppSessionRequest - (*BlockNumber)(nil), // 37: webrpc.BlockNumber - (*AppSessionStatus)(nil), // 38: webrpc.AppSessionStatus - (*GetStateForAppSessionRequest)(nil), // 39: webrpc.GetStateForAppSessionRequest - (*AppSessionState)(nil), // 40: webrpc.AppSessionState - (*AppSessionSeqNum)(nil), // 41: webrpc.AppSessionSeqNum - (*SetMsgDropReq)(nil), // 42: webrpc.SetMsgDropReq - (*PaymentStatus)(nil), // 43: webrpc.PaymentStatus - (*rpc.OneHistoricalPay)(nil), // 44: rpc.OneHistoricalPay - (entity.TokenType)(0), // 45: entity.TokenType - (entity.TransferFunctionType)(0), // 46: entity.TransferFunctionType - (*anypb.Any)(nil), // 47: google.protobuf.Any - (*emptypb.Empty)(nil), // 48: google.protobuf.Empty + (*GetPayHistoryRequest)(nil), // 0: webrpc.GetPayHistoryRequest + (*GetPayHistoryResponse)(nil), // 1: webrpc.GetPayHistoryResponse + (*TokenInfo)(nil), // 2: webrpc.TokenInfo + (*SetDelegationRequest)(nil), // 3: webrpc.SetDelegationRequest + (*OpenPaymentChannelRequest)(nil), // 4: webrpc.OpenPaymentChannelRequest + (*ChannelID)(nil), // 5: webrpc.ChannelID + (*DepositOrWithdrawRequest)(nil), // 6: webrpc.DepositOrWithdrawRequest + (*DepositOrWithdrawJob)(nil), // 7: webrpc.DepositOrWithdrawJob + (*GetBalanceResponse)(nil), // 8: webrpc.GetBalanceResponse + (*GetPeerFreeBalanceRequest)(nil), // 9: webrpc.GetPeerFreeBalanceRequest + (*FreeBalance)(nil), // 10: webrpc.FreeBalance + (*Condition)(nil), // 11: webrpc.Condition + (*SendConditionalPaymentRequest)(nil), // 12: webrpc.SendConditionalPaymentRequest + (*SendTokenRequest)(nil), // 13: webrpc.SendTokenRequest + (*PaymentID)(nil), // 14: webrpc.PaymentID + (*PaymentInfo)(nil), // 15: webrpc.PaymentInfo + (*OutgoingPaymentInfo)(nil), // 16: webrpc.OutgoingPaymentInfo + (*OnChainPaymentInfo)(nil), // 17: webrpc.OnChainPaymentInfo + (*SessionID)(nil), // 18: webrpc.SessionID + (*CreateAppSessionOnVirtualContractRequest)(nil), // 19: webrpc.CreateAppSessionOnVirtualContractRequest + (*Data)(nil), // 20: webrpc.Data + (*Signature)(nil), // 21: webrpc.Signature + (*Address)(nil), // 22: webrpc.Address + (*GetBooleanOutcomeForAppSessionRequest)(nil), // 23: webrpc.GetBooleanOutcomeForAppSessionRequest + (*BooleanOutcome)(nil), // 24: webrpc.BooleanOutcome + (*BlockNumber)(nil), // 25: webrpc.BlockNumber + (*Timestamp)(nil), // 26: webrpc.Timestamp + (*SetMsgDropReq)(nil), // 27: webrpc.SetMsgDropReq + (*PaymentStatus)(nil), // 28: webrpc.PaymentStatus + (*rpc.OneHistoricalPay)(nil), // 29: rpc.OneHistoricalPay + (entity.TokenType)(0), // 30: entity.TokenType + (entity.TransferFunctionType)(0), // 31: entity.TransferFunctionType + (*anypb.Any)(nil), // 32: google.protobuf.Any + (*emptypb.Empty)(nil), // 33: google.protobuf.Empty } var file_web_api_proto_depIdxs = []int32{ - 44, // 0: webrpc.GetPayHistoryResponse.pays:type_name -> rpc.OneHistoricalPay - 45, // 1: webrpc.TokenInfo.token_type:type_name -> entity.TokenType + 29, // 0: webrpc.GetPayHistoryResponse.pays:type_name -> rpc.OneHistoricalPay + 30, // 1: webrpc.TokenInfo.token_type:type_name -> entity.TokenType 2, // 2: webrpc.SetDelegationRequest.token_infos:type_name -> webrpc.TokenInfo 2, // 3: webrpc.OpenPaymentChannelRequest.token_info:type_name -> webrpc.TokenInfo 2, // 4: webrpc.DepositOrWithdrawRequest.token_info:type_name -> webrpc.TokenInfo 2, // 5: webrpc.GetPeerFreeBalanceRequest.token_info:type_name -> webrpc.TokenInfo 2, // 6: webrpc.SendConditionalPaymentRequest.token_info:type_name -> webrpc.TokenInfo - 46, // 7: webrpc.SendConditionalPaymentRequest.transfer_logic_type:type_name -> entity.TransferFunctionType + 31, // 7: webrpc.SendConditionalPaymentRequest.transfer_logic_type:type_name -> entity.TransferFunctionType 11, // 8: webrpc.SendConditionalPaymentRequest.conditions:type_name -> webrpc.Condition - 47, // 9: webrpc.SendConditionalPaymentRequest.note:type_name -> google.protobuf.Any + 32, // 9: webrpc.SendConditionalPaymentRequest.note:type_name -> google.protobuf.Any 2, // 10: webrpc.SendTokenRequest.token_info:type_name -> webrpc.TokenInfo - 47, // 11: webrpc.SendTokenRequest.note:type_name -> google.protobuf.Any + 32, // 11: webrpc.SendTokenRequest.note:type_name -> google.protobuf.Any 2, // 12: webrpc.PaymentInfo.token_info:type_name -> webrpc.TokenInfo 15, // 13: webrpc.OutgoingPaymentInfo.payment:type_name -> webrpc.PaymentInfo 0, // 14: webrpc.WebApi.GetPayHistory:input_type -> webrpc.GetPayHistoryRequest @@ -2717,8 +1850,8 @@ var file_web_api_proto_depIdxs = []int32{ 9, // 24: webrpc.WebApi.GetPeerFreeBalance:input_type -> webrpc.GetPeerFreeBalanceRequest 13, // 25: webrpc.WebApi.SendToken:input_type -> webrpc.SendTokenRequest 12, // 26: webrpc.WebApi.SendConditionalPayment:input_type -> webrpc.SendConditionalPaymentRequest - 48, // 27: webrpc.WebApi.SubscribeIncomingPayments:input_type -> google.protobuf.Empty - 48, // 28: webrpc.WebApi.SubscribeOutgoingPayments:input_type -> google.protobuf.Empty + 33, // 27: webrpc.WebApi.SubscribeIncomingPayments:input_type -> google.protobuf.Empty + 33, // 28: webrpc.WebApi.SubscribeOutgoingPayments:input_type -> google.protobuf.Empty 14, // 29: webrpc.WebApi.GetIncomingPaymentStatus:input_type -> webrpc.PaymentID 14, // 30: webrpc.WebApi.GetIncomingPaymentInfo:input_type -> webrpc.PaymentID 14, // 31: webrpc.WebApi.GetOutgoingPaymentStatus:input_type -> webrpc.PaymentID @@ -2735,89 +1868,55 @@ var file_web_api_proto_depIdxs = []int32{ 2, // 42: webrpc.WebApi.ConfirmSettlePaymentChannel:input_type -> webrpc.TokenInfo 2, // 43: webrpc.WebApi.GetSettleFinalizedTimeForPaymentChannel:input_type -> webrpc.TokenInfo 2, // 44: webrpc.WebApi.SyncOnChainPaymentChannelStatus:input_type -> webrpc.TokenInfo - 48, // 45: webrpc.WebApi.SyncStateWithPeer:input_type -> google.protobuf.Empty + 33, // 45: webrpc.WebApi.SyncStateWithPeer:input_type -> google.protobuf.Empty 19, // 46: webrpc.WebApi.CreateAppSessionOnVirtualContract:input_type -> webrpc.CreateAppSessionOnVirtualContractRequest - 20, // 47: webrpc.WebApi.CreateAppSessionOnDeployedContract:input_type -> webrpc.CreateAppSessionOnDeployedContractRequest - 18, // 48: webrpc.WebApi.SubscribeAppSessionDispute:input_type -> webrpc.SessionID - 22, // 49: webrpc.WebApi.SignOutgoingState:input_type -> webrpc.SignOutgoingStateRequest - 26, // 50: webrpc.WebApi.ValidateAck:input_type -> webrpc.ValidateAckRequest - 24, // 51: webrpc.WebApi.SignData:input_type -> webrpc.Data - 28, // 52: webrpc.WebApi.ProcessReceivedState:input_type -> webrpc.ProcessReceivedStateRequest - 30, // 53: webrpc.WebApi.SettleAppSession:input_type -> webrpc.SettleAppSessionRequest - 31, // 54: webrpc.WebApi.SettleAppSessionBySigTimeout:input_type -> webrpc.SettleAppSessionByTimeoutRequest - 31, // 55: webrpc.WebApi.SettleAppSessionByMoveTimeout:input_type -> webrpc.SettleAppSessionByTimeoutRequest - 32, // 56: webrpc.WebApi.SettleAppSessionByInvalidTurn:input_type -> webrpc.SettleAppSessionByInvalidityRequest - 32, // 57: webrpc.WebApi.SettleAppSessionByInvalidState:input_type -> webrpc.SettleAppSessionByInvalidityRequest - 18, // 58: webrpc.WebApi.DeleteAppSession:input_type -> webrpc.SessionID - 18, // 59: webrpc.WebApi.GetDeployedAddressForAppSession:input_type -> webrpc.SessionID - 34, // 60: webrpc.WebApi.GetBooleanOutcomeForAppSession:input_type -> webrpc.GetBooleanOutcomeForAppSessionRequest - 36, // 61: webrpc.WebApi.ApplyActionForAppSession:input_type -> webrpc.ApplyActionForAppSessionRequest - 18, // 62: webrpc.WebApi.FinalizeOnActionTimeoutForAppSession:input_type -> webrpc.SessionID - 18, // 63: webrpc.WebApi.GetSettleFinalizedTimeForAppSession:input_type -> webrpc.SessionID - 18, // 64: webrpc.WebApi.GetActionDeadlineForAppSession:input_type -> webrpc.SessionID - 18, // 65: webrpc.WebApi.GetStatusForAppSession:input_type -> webrpc.SessionID - 39, // 66: webrpc.WebApi.GetStateForAppSession:input_type -> webrpc.GetStateForAppSessionRequest - 18, // 67: webrpc.WebApi.GetSeqNumForAppSession:input_type -> webrpc.SessionID - 48, // 68: webrpc.WebApi.GetBlockNumber:input_type -> google.protobuf.Empty - 42, // 69: webrpc.WebApi.SetMsgDropper:input_type -> webrpc.SetMsgDropReq - 1, // 70: webrpc.WebApi.GetPayHistory:output_type -> webrpc.GetPayHistoryResponse - 48, // 71: webrpc.WebApi.SetDelegation:output_type -> google.protobuf.Empty - 5, // 72: webrpc.WebApi.OpenPaymentChannel:output_type -> webrpc.ChannelID - 7, // 73: webrpc.WebApi.Deposit:output_type -> webrpc.DepositOrWithdrawJob - 7, // 74: webrpc.WebApi.DepositNonBlocking:output_type -> webrpc.DepositOrWithdrawJob - 7, // 75: webrpc.WebApi.MonitorDepositJob:output_type -> webrpc.DepositOrWithdrawJob - 7, // 76: webrpc.WebApi.CooperativeWithdraw:output_type -> webrpc.DepositOrWithdrawJob - 7, // 77: webrpc.WebApi.CooperativeWithdrawNonBlocking:output_type -> webrpc.DepositOrWithdrawJob - 7, // 78: webrpc.WebApi.MonitorCooperativeWithdrawJob:output_type -> webrpc.DepositOrWithdrawJob - 8, // 79: webrpc.WebApi.GetBalance:output_type -> webrpc.GetBalanceResponse - 10, // 80: webrpc.WebApi.GetPeerFreeBalance:output_type -> webrpc.FreeBalance - 14, // 81: webrpc.WebApi.SendToken:output_type -> webrpc.PaymentID - 14, // 82: webrpc.WebApi.SendConditionalPayment:output_type -> webrpc.PaymentID - 15, // 83: webrpc.WebApi.SubscribeIncomingPayments:output_type -> webrpc.PaymentInfo - 16, // 84: webrpc.WebApi.SubscribeOutgoingPayments:output_type -> webrpc.OutgoingPaymentInfo - 43, // 85: webrpc.WebApi.GetIncomingPaymentStatus:output_type -> webrpc.PaymentStatus - 15, // 86: webrpc.WebApi.GetIncomingPaymentInfo:output_type -> webrpc.PaymentInfo - 43, // 87: webrpc.WebApi.GetOutgoingPaymentStatus:output_type -> webrpc.PaymentStatus - 48, // 88: webrpc.WebApi.ConfirmOutgoingPayment:output_type -> google.protobuf.Empty - 48, // 89: webrpc.WebApi.RejectIncomingPayment:output_type -> google.protobuf.Empty - 48, // 90: webrpc.WebApi.SettleOnChainResolvedIncomingPayment:output_type -> google.protobuf.Empty - 48, // 91: webrpc.WebApi.ResolveIncomingPaymentOnChain:output_type -> google.protobuf.Empty - 17, // 92: webrpc.WebApi.GetOnChainPaymentInfo:output_type -> webrpc.OnChainPaymentInfo - 48, // 93: webrpc.WebApi.ConfirmOnChainResolvedPayments:output_type -> google.protobuf.Empty - 48, // 94: webrpc.WebApi.SettleExpiredPayments:output_type -> google.protobuf.Empty - 48, // 95: webrpc.WebApi.IntendWithdraw:output_type -> google.protobuf.Empty - 48, // 96: webrpc.WebApi.ConfirmWithdraw:output_type -> google.protobuf.Empty - 48, // 97: webrpc.WebApi.IntendSettlePaymentChannel:output_type -> google.protobuf.Empty - 48, // 98: webrpc.WebApi.ConfirmSettlePaymentChannel:output_type -> google.protobuf.Empty - 37, // 99: webrpc.WebApi.GetSettleFinalizedTimeForPaymentChannel:output_type -> webrpc.BlockNumber - 48, // 100: webrpc.WebApi.SyncOnChainPaymentChannelStatus:output_type -> google.protobuf.Empty - 48, // 101: webrpc.WebApi.SyncStateWithPeer:output_type -> google.protobuf.Empty - 18, // 102: webrpc.WebApi.CreateAppSessionOnVirtualContract:output_type -> webrpc.SessionID - 18, // 103: webrpc.WebApi.CreateAppSessionOnDeployedContract:output_type -> webrpc.SessionID - 21, // 104: webrpc.WebApi.SubscribeAppSessionDispute:output_type -> webrpc.DisputeInfo - 23, // 105: webrpc.WebApi.SignOutgoingState:output_type -> webrpc.SignedState - 27, // 106: webrpc.WebApi.ValidateAck:output_type -> webrpc.BoolValue - 25, // 107: webrpc.WebApi.SignData:output_type -> webrpc.Signature - 29, // 108: webrpc.WebApi.ProcessReceivedState:output_type -> webrpc.ProcessReceivedStateResponse - 48, // 109: webrpc.WebApi.SettleAppSession:output_type -> google.protobuf.Empty - 48, // 110: webrpc.WebApi.SettleAppSessionBySigTimeout:output_type -> google.protobuf.Empty - 48, // 111: webrpc.WebApi.SettleAppSessionByMoveTimeout:output_type -> google.protobuf.Empty - 48, // 112: webrpc.WebApi.SettleAppSessionByInvalidTurn:output_type -> google.protobuf.Empty - 48, // 113: webrpc.WebApi.SettleAppSessionByInvalidState:output_type -> google.protobuf.Empty - 48, // 114: webrpc.WebApi.DeleteAppSession:output_type -> google.protobuf.Empty - 33, // 115: webrpc.WebApi.GetDeployedAddressForAppSession:output_type -> webrpc.Address - 35, // 116: webrpc.WebApi.GetBooleanOutcomeForAppSession:output_type -> webrpc.BooleanOutcome - 48, // 117: webrpc.WebApi.ApplyActionForAppSession:output_type -> google.protobuf.Empty - 48, // 118: webrpc.WebApi.FinalizeOnActionTimeoutForAppSession:output_type -> google.protobuf.Empty - 37, // 119: webrpc.WebApi.GetSettleFinalizedTimeForAppSession:output_type -> webrpc.BlockNumber - 37, // 120: webrpc.WebApi.GetActionDeadlineForAppSession:output_type -> webrpc.BlockNumber - 38, // 121: webrpc.WebApi.GetStatusForAppSession:output_type -> webrpc.AppSessionStatus - 40, // 122: webrpc.WebApi.GetStateForAppSession:output_type -> webrpc.AppSessionState - 41, // 123: webrpc.WebApi.GetSeqNumForAppSession:output_type -> webrpc.AppSessionSeqNum - 37, // 124: webrpc.WebApi.GetBlockNumber:output_type -> webrpc.BlockNumber - 48, // 125: webrpc.WebApi.SetMsgDropper:output_type -> google.protobuf.Empty - 70, // [70:126] is the sub-list for method output_type - 14, // [14:70] is the sub-list for method input_type + 20, // 47: webrpc.WebApi.SignData:input_type -> webrpc.Data + 18, // 48: webrpc.WebApi.DeleteAppSession:input_type -> webrpc.SessionID + 18, // 49: webrpc.WebApi.GetDeployedAddressForAppSession:input_type -> webrpc.SessionID + 23, // 50: webrpc.WebApi.GetBooleanOutcomeForAppSession:input_type -> webrpc.GetBooleanOutcomeForAppSessionRequest + 33, // 51: webrpc.WebApi.GetBlockNumber:input_type -> google.protobuf.Empty + 27, // 52: webrpc.WebApi.SetMsgDropper:input_type -> webrpc.SetMsgDropReq + 1, // 53: webrpc.WebApi.GetPayHistory:output_type -> webrpc.GetPayHistoryResponse + 33, // 54: webrpc.WebApi.SetDelegation:output_type -> google.protobuf.Empty + 5, // 55: webrpc.WebApi.OpenPaymentChannel:output_type -> webrpc.ChannelID + 7, // 56: webrpc.WebApi.Deposit:output_type -> webrpc.DepositOrWithdrawJob + 7, // 57: webrpc.WebApi.DepositNonBlocking:output_type -> webrpc.DepositOrWithdrawJob + 7, // 58: webrpc.WebApi.MonitorDepositJob:output_type -> webrpc.DepositOrWithdrawJob + 7, // 59: webrpc.WebApi.CooperativeWithdraw:output_type -> webrpc.DepositOrWithdrawJob + 7, // 60: webrpc.WebApi.CooperativeWithdrawNonBlocking:output_type -> webrpc.DepositOrWithdrawJob + 7, // 61: webrpc.WebApi.MonitorCooperativeWithdrawJob:output_type -> webrpc.DepositOrWithdrawJob + 8, // 62: webrpc.WebApi.GetBalance:output_type -> webrpc.GetBalanceResponse + 10, // 63: webrpc.WebApi.GetPeerFreeBalance:output_type -> webrpc.FreeBalance + 14, // 64: webrpc.WebApi.SendToken:output_type -> webrpc.PaymentID + 14, // 65: webrpc.WebApi.SendConditionalPayment:output_type -> webrpc.PaymentID + 15, // 66: webrpc.WebApi.SubscribeIncomingPayments:output_type -> webrpc.PaymentInfo + 16, // 67: webrpc.WebApi.SubscribeOutgoingPayments:output_type -> webrpc.OutgoingPaymentInfo + 28, // 68: webrpc.WebApi.GetIncomingPaymentStatus:output_type -> webrpc.PaymentStatus + 15, // 69: webrpc.WebApi.GetIncomingPaymentInfo:output_type -> webrpc.PaymentInfo + 28, // 70: webrpc.WebApi.GetOutgoingPaymentStatus:output_type -> webrpc.PaymentStatus + 33, // 71: webrpc.WebApi.ConfirmOutgoingPayment:output_type -> google.protobuf.Empty + 33, // 72: webrpc.WebApi.RejectIncomingPayment:output_type -> google.protobuf.Empty + 33, // 73: webrpc.WebApi.SettleOnChainResolvedIncomingPayment:output_type -> google.protobuf.Empty + 33, // 74: webrpc.WebApi.ResolveIncomingPaymentOnChain:output_type -> google.protobuf.Empty + 17, // 75: webrpc.WebApi.GetOnChainPaymentInfo:output_type -> webrpc.OnChainPaymentInfo + 33, // 76: webrpc.WebApi.ConfirmOnChainResolvedPayments:output_type -> google.protobuf.Empty + 33, // 77: webrpc.WebApi.SettleExpiredPayments:output_type -> google.protobuf.Empty + 33, // 78: webrpc.WebApi.IntendWithdraw:output_type -> google.protobuf.Empty + 33, // 79: webrpc.WebApi.ConfirmWithdraw:output_type -> google.protobuf.Empty + 33, // 80: webrpc.WebApi.IntendSettlePaymentChannel:output_type -> google.protobuf.Empty + 33, // 81: webrpc.WebApi.ConfirmSettlePaymentChannel:output_type -> google.protobuf.Empty + 26, // 82: webrpc.WebApi.GetSettleFinalizedTimeForPaymentChannel:output_type -> webrpc.Timestamp + 33, // 83: webrpc.WebApi.SyncOnChainPaymentChannelStatus:output_type -> google.protobuf.Empty + 33, // 84: webrpc.WebApi.SyncStateWithPeer:output_type -> google.protobuf.Empty + 18, // 85: webrpc.WebApi.CreateAppSessionOnVirtualContract:output_type -> webrpc.SessionID + 21, // 86: webrpc.WebApi.SignData:output_type -> webrpc.Signature + 33, // 87: webrpc.WebApi.DeleteAppSession:output_type -> google.protobuf.Empty + 22, // 88: webrpc.WebApi.GetDeployedAddressForAppSession:output_type -> webrpc.Address + 24, // 89: webrpc.WebApi.GetBooleanOutcomeForAppSession:output_type -> webrpc.BooleanOutcome + 25, // 90: webrpc.WebApi.GetBlockNumber:output_type -> webrpc.BlockNumber + 33, // 91: webrpc.WebApi.SetMsgDropper:output_type -> google.protobuf.Empty + 53, // [53:92] is the sub-list for method output_type + 14, // [14:53] is the sub-list for method input_type 14, // [14:14] is the sub-list for extension type_name 14, // [14:14] is the sub-list for extension extendee 0, // [0:14] is the sub-list for field type_name @@ -2834,7 +1933,7 @@ func file_web_api_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_web_api_proto_rawDesc), len(file_web_api_proto_rawDesc)), NumEnums: 0, - NumMessages: 44, + NumMessages: 29, NumExtensions: 0, NumServices: 1, }, diff --git a/webapi/rpc/web_api_grpc.pb.go b/webapi/rpc/web_api_grpc.pb.go index 126ecb9..7a1a561 100644 --- a/webapi/rpc/web_api_grpc.pb.go +++ b/webapi/rpc/web_api_grpc.pb.go @@ -4,7 +4,6 @@ package rpc import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -72,31 +71,14 @@ type WebApiClient interface { ConfirmWithdraw(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*emptypb.Empty, error) IntendSettlePaymentChannel(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*emptypb.Empty, error) ConfirmSettlePaymentChannel(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*emptypb.Empty, error) - GetSettleFinalizedTimeForPaymentChannel(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*BlockNumber, error) + GetSettleFinalizedTimeForPaymentChannel(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*Timestamp, error) SyncOnChainPaymentChannelStatus(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*emptypb.Empty, error) SyncStateWithPeer(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) CreateAppSessionOnVirtualContract(ctx context.Context, in *CreateAppSessionOnVirtualContractRequest, opts ...grpc.CallOption) (*SessionID, error) - CreateAppSessionOnDeployedContract(ctx context.Context, in *CreateAppSessionOnDeployedContractRequest, opts ...grpc.CallOption) (*SessionID, error) - SubscribeAppSessionDispute(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (WebApi_SubscribeAppSessionDisputeClient, error) - SignOutgoingState(ctx context.Context, in *SignOutgoingStateRequest, opts ...grpc.CallOption) (*SignedState, error) - ValidateAck(ctx context.Context, in *ValidateAckRequest, opts ...grpc.CallOption) (*BoolValue, error) SignData(ctx context.Context, in *Data, opts ...grpc.CallOption) (*Signature, error) - ProcessReceivedState(ctx context.Context, in *ProcessReceivedStateRequest, opts ...grpc.CallOption) (*ProcessReceivedStateResponse, error) - SettleAppSession(ctx context.Context, in *SettleAppSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - SettleAppSessionBySigTimeout(ctx context.Context, in *SettleAppSessionByTimeoutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - SettleAppSessionByMoveTimeout(ctx context.Context, in *SettleAppSessionByTimeoutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - SettleAppSessionByInvalidTurn(ctx context.Context, in *SettleAppSessionByInvalidityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - SettleAppSessionByInvalidState(ctx context.Context, in *SettleAppSessionByInvalidityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) DeleteAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*emptypb.Empty, error) GetDeployedAddressForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*Address, error) GetBooleanOutcomeForAppSession(ctx context.Context, in *GetBooleanOutcomeForAppSessionRequest, opts ...grpc.CallOption) (*BooleanOutcome, error) - ApplyActionForAppSession(ctx context.Context, in *ApplyActionForAppSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) - FinalizeOnActionTimeoutForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*emptypb.Empty, error) - GetSettleFinalizedTimeForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*BlockNumber, error) - GetActionDeadlineForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*BlockNumber, error) - GetStatusForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*AppSessionStatus, error) - GetStateForAppSession(ctx context.Context, in *GetStateForAppSessionRequest, opts ...grpc.CallOption) (*AppSessionState, error) - GetSeqNumForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*AppSessionSeqNum, error) GetBlockNumber(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*BlockNumber, error) SetMsgDropper(ctx context.Context, in *SetMsgDropReq, opts ...grpc.CallOption) (*emptypb.Empty, error) } @@ -416,8 +398,8 @@ func (c *webApiClient) ConfirmSettlePaymentChannel(ctx context.Context, in *Toke return out, nil } -func (c *webApiClient) GetSettleFinalizedTimeForPaymentChannel(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*BlockNumber, error) { - out := new(BlockNumber) +func (c *webApiClient) GetSettleFinalizedTimeForPaymentChannel(ctx context.Context, in *TokenInfo, opts ...grpc.CallOption) (*Timestamp, error) { + out := new(Timestamp) err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetSettleFinalizedTimeForPaymentChannel", in, out, opts...) if err != nil { return nil, err @@ -452,65 +434,6 @@ func (c *webApiClient) CreateAppSessionOnVirtualContract(ctx context.Context, in return out, nil } -func (c *webApiClient) CreateAppSessionOnDeployedContract(ctx context.Context, in *CreateAppSessionOnDeployedContractRequest, opts ...grpc.CallOption) (*SessionID, error) { - out := new(SessionID) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/CreateAppSessionOnDeployedContract", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) SubscribeAppSessionDispute(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (WebApi_SubscribeAppSessionDisputeClient, error) { - stream, err := c.cc.NewStream(ctx, &_WebApi_serviceDesc.Streams[2], "/webrpc.WebApi/SubscribeAppSessionDispute", opts...) - if err != nil { - return nil, err - } - x := &webApiSubscribeAppSessionDisputeClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type WebApi_SubscribeAppSessionDisputeClient interface { - Recv() (*DisputeInfo, error) - grpc.ClientStream -} - -type webApiSubscribeAppSessionDisputeClient struct { - grpc.ClientStream -} - -func (x *webApiSubscribeAppSessionDisputeClient) Recv() (*DisputeInfo, error) { - m := new(DisputeInfo) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *webApiClient) SignOutgoingState(ctx context.Context, in *SignOutgoingStateRequest, opts ...grpc.CallOption) (*SignedState, error) { - out := new(SignedState) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/SignOutgoingState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) ValidateAck(ctx context.Context, in *ValidateAckRequest, opts ...grpc.CallOption) (*BoolValue, error) { - out := new(BoolValue) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/ValidateAck", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *webApiClient) SignData(ctx context.Context, in *Data, opts ...grpc.CallOption) (*Signature, error) { out := new(Signature) err := c.cc.Invoke(ctx, "/webrpc.WebApi/SignData", in, out, opts...) @@ -520,60 +443,6 @@ func (c *webApiClient) SignData(ctx context.Context, in *Data, opts ...grpc.Call return out, nil } -func (c *webApiClient) ProcessReceivedState(ctx context.Context, in *ProcessReceivedStateRequest, opts ...grpc.CallOption) (*ProcessReceivedStateResponse, error) { - out := new(ProcessReceivedStateResponse) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/ProcessReceivedState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) SettleAppSession(ctx context.Context, in *SettleAppSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/SettleAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) SettleAppSessionBySigTimeout(ctx context.Context, in *SettleAppSessionByTimeoutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/SettleAppSessionBySigTimeout", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) SettleAppSessionByMoveTimeout(ctx context.Context, in *SettleAppSessionByTimeoutRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/SettleAppSessionByMoveTimeout", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) SettleAppSessionByInvalidTurn(ctx context.Context, in *SettleAppSessionByInvalidityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/SettleAppSessionByInvalidTurn", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) SettleAppSessionByInvalidState(ctx context.Context, in *SettleAppSessionByInvalidityRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/SettleAppSessionByInvalidState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *webApiClient) DeleteAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) err := c.cc.Invoke(ctx, "/webrpc.WebApi/DeleteAppSession", in, out, opts...) @@ -601,69 +470,6 @@ func (c *webApiClient) GetBooleanOutcomeForAppSession(ctx context.Context, in *G return out, nil } -func (c *webApiClient) ApplyActionForAppSession(ctx context.Context, in *ApplyActionForAppSessionRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/ApplyActionForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) FinalizeOnActionTimeoutForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*emptypb.Empty, error) { - out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/FinalizeOnActionTimeoutForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) GetSettleFinalizedTimeForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*BlockNumber, error) { - out := new(BlockNumber) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetSettleFinalizedTimeForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) GetActionDeadlineForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*BlockNumber, error) { - out := new(BlockNumber) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetActionDeadlineForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) GetStatusForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*AppSessionStatus, error) { - out := new(AppSessionStatus) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetStatusForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) GetStateForAppSession(ctx context.Context, in *GetStateForAppSessionRequest, opts ...grpc.CallOption) (*AppSessionState, error) { - out := new(AppSessionState) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetStateForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *webApiClient) GetSeqNumForAppSession(ctx context.Context, in *SessionID, opts ...grpc.CallOption) (*AppSessionSeqNum, error) { - out := new(AppSessionSeqNum) - err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetSeqNumForAppSession", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *webApiClient) GetBlockNumber(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*BlockNumber, error) { out := new(BlockNumber) err := c.cc.Invoke(ctx, "/webrpc.WebApi/GetBlockNumber", in, out, opts...) @@ -683,7 +489,7 @@ func (c *webApiClient) SetMsgDropper(ctx context.Context, in *SetMsgDropReq, opt } // WebApiServer is the server API for WebApi service. -// All implementations should embed UnimplementedWebApiServer +// All implementations must embed UnimplementedWebApiServer // for forward compatibility type WebApiServer interface { GetPayHistory(context.Context, *GetPayHistoryRequest) (*GetPayHistoryResponse, error) @@ -739,36 +545,20 @@ type WebApiServer interface { ConfirmWithdraw(context.Context, *TokenInfo) (*emptypb.Empty, error) IntendSettlePaymentChannel(context.Context, *TokenInfo) (*emptypb.Empty, error) ConfirmSettlePaymentChannel(context.Context, *TokenInfo) (*emptypb.Empty, error) - GetSettleFinalizedTimeForPaymentChannel(context.Context, *TokenInfo) (*BlockNumber, error) + GetSettleFinalizedTimeForPaymentChannel(context.Context, *TokenInfo) (*Timestamp, error) SyncOnChainPaymentChannelStatus(context.Context, *TokenInfo) (*emptypb.Empty, error) SyncStateWithPeer(context.Context, *emptypb.Empty) (*emptypb.Empty, error) CreateAppSessionOnVirtualContract(context.Context, *CreateAppSessionOnVirtualContractRequest) (*SessionID, error) - CreateAppSessionOnDeployedContract(context.Context, *CreateAppSessionOnDeployedContractRequest) (*SessionID, error) - SubscribeAppSessionDispute(*SessionID, WebApi_SubscribeAppSessionDisputeServer) error - SignOutgoingState(context.Context, *SignOutgoingStateRequest) (*SignedState, error) - ValidateAck(context.Context, *ValidateAckRequest) (*BoolValue, error) SignData(context.Context, *Data) (*Signature, error) - ProcessReceivedState(context.Context, *ProcessReceivedStateRequest) (*ProcessReceivedStateResponse, error) - SettleAppSession(context.Context, *SettleAppSessionRequest) (*emptypb.Empty, error) - SettleAppSessionBySigTimeout(context.Context, *SettleAppSessionByTimeoutRequest) (*emptypb.Empty, error) - SettleAppSessionByMoveTimeout(context.Context, *SettleAppSessionByTimeoutRequest) (*emptypb.Empty, error) - SettleAppSessionByInvalidTurn(context.Context, *SettleAppSessionByInvalidityRequest) (*emptypb.Empty, error) - SettleAppSessionByInvalidState(context.Context, *SettleAppSessionByInvalidityRequest) (*emptypb.Empty, error) DeleteAppSession(context.Context, *SessionID) (*emptypb.Empty, error) GetDeployedAddressForAppSession(context.Context, *SessionID) (*Address, error) GetBooleanOutcomeForAppSession(context.Context, *GetBooleanOutcomeForAppSessionRequest) (*BooleanOutcome, error) - ApplyActionForAppSession(context.Context, *ApplyActionForAppSessionRequest) (*emptypb.Empty, error) - FinalizeOnActionTimeoutForAppSession(context.Context, *SessionID) (*emptypb.Empty, error) - GetSettleFinalizedTimeForAppSession(context.Context, *SessionID) (*BlockNumber, error) - GetActionDeadlineForAppSession(context.Context, *SessionID) (*BlockNumber, error) - GetStatusForAppSession(context.Context, *SessionID) (*AppSessionStatus, error) - GetStateForAppSession(context.Context, *GetStateForAppSessionRequest) (*AppSessionState, error) - GetSeqNumForAppSession(context.Context, *SessionID) (*AppSessionSeqNum, error) GetBlockNumber(context.Context, *emptypb.Empty) (*BlockNumber, error) SetMsgDropper(context.Context, *SetMsgDropReq) (*emptypb.Empty, error) + mustEmbedUnimplementedWebApiServer() } -// UnimplementedWebApiServer should be embedded to have forward compatible implementations. +// UnimplementedWebApiServer must be embedded to have forward compatible implementations. type UnimplementedWebApiServer struct { } @@ -859,7 +649,7 @@ func (UnimplementedWebApiServer) IntendSettlePaymentChannel(context.Context, *To func (UnimplementedWebApiServer) ConfirmSettlePaymentChannel(context.Context, *TokenInfo) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method ConfirmSettlePaymentChannel not implemented") } -func (UnimplementedWebApiServer) GetSettleFinalizedTimeForPaymentChannel(context.Context, *TokenInfo) (*BlockNumber, error) { +func (UnimplementedWebApiServer) GetSettleFinalizedTimeForPaymentChannel(context.Context, *TokenInfo) (*Timestamp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetSettleFinalizedTimeForPaymentChannel not implemented") } func (UnimplementedWebApiServer) SyncOnChainPaymentChannelStatus(context.Context, *TokenInfo) (*emptypb.Empty, error) { @@ -871,39 +661,9 @@ func (UnimplementedWebApiServer) SyncStateWithPeer(context.Context, *emptypb.Emp func (UnimplementedWebApiServer) CreateAppSessionOnVirtualContract(context.Context, *CreateAppSessionOnVirtualContractRequest) (*SessionID, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateAppSessionOnVirtualContract not implemented") } -func (UnimplementedWebApiServer) CreateAppSessionOnDeployedContract(context.Context, *CreateAppSessionOnDeployedContractRequest) (*SessionID, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateAppSessionOnDeployedContract not implemented") -} -func (UnimplementedWebApiServer) SubscribeAppSessionDispute(*SessionID, WebApi_SubscribeAppSessionDisputeServer) error { - return status.Errorf(codes.Unimplemented, "method SubscribeAppSessionDispute not implemented") -} -func (UnimplementedWebApiServer) SignOutgoingState(context.Context, *SignOutgoingStateRequest) (*SignedState, error) { - return nil, status.Errorf(codes.Unimplemented, "method SignOutgoingState not implemented") -} -func (UnimplementedWebApiServer) ValidateAck(context.Context, *ValidateAckRequest) (*BoolValue, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAck not implemented") -} func (UnimplementedWebApiServer) SignData(context.Context, *Data) (*Signature, error) { return nil, status.Errorf(codes.Unimplemented, "method SignData not implemented") } -func (UnimplementedWebApiServer) ProcessReceivedState(context.Context, *ProcessReceivedStateRequest) (*ProcessReceivedStateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ProcessReceivedState not implemented") -} -func (UnimplementedWebApiServer) SettleAppSession(context.Context, *SettleAppSessionRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettleAppSession not implemented") -} -func (UnimplementedWebApiServer) SettleAppSessionBySigTimeout(context.Context, *SettleAppSessionByTimeoutRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettleAppSessionBySigTimeout not implemented") -} -func (UnimplementedWebApiServer) SettleAppSessionByMoveTimeout(context.Context, *SettleAppSessionByTimeoutRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettleAppSessionByMoveTimeout not implemented") -} -func (UnimplementedWebApiServer) SettleAppSessionByInvalidTurn(context.Context, *SettleAppSessionByInvalidityRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettleAppSessionByInvalidTurn not implemented") -} -func (UnimplementedWebApiServer) SettleAppSessionByInvalidState(context.Context, *SettleAppSessionByInvalidityRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettleAppSessionByInvalidState not implemented") -} func (UnimplementedWebApiServer) DeleteAppSession(context.Context, *SessionID) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method DeleteAppSession not implemented") } @@ -913,33 +673,13 @@ func (UnimplementedWebApiServer) GetDeployedAddressForAppSession(context.Context func (UnimplementedWebApiServer) GetBooleanOutcomeForAppSession(context.Context, *GetBooleanOutcomeForAppSessionRequest) (*BooleanOutcome, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBooleanOutcomeForAppSession not implemented") } -func (UnimplementedWebApiServer) ApplyActionForAppSession(context.Context, *ApplyActionForAppSessionRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApplyActionForAppSession not implemented") -} -func (UnimplementedWebApiServer) FinalizeOnActionTimeoutForAppSession(context.Context, *SessionID) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizeOnActionTimeoutForAppSession not implemented") -} -func (UnimplementedWebApiServer) GetSettleFinalizedTimeForAppSession(context.Context, *SessionID) (*BlockNumber, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSettleFinalizedTimeForAppSession not implemented") -} -func (UnimplementedWebApiServer) GetActionDeadlineForAppSession(context.Context, *SessionID) (*BlockNumber, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetActionDeadlineForAppSession not implemented") -} -func (UnimplementedWebApiServer) GetStatusForAppSession(context.Context, *SessionID) (*AppSessionStatus, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetStatusForAppSession not implemented") -} -func (UnimplementedWebApiServer) GetStateForAppSession(context.Context, *GetStateForAppSessionRequest) (*AppSessionState, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetStateForAppSession not implemented") -} -func (UnimplementedWebApiServer) GetSeqNumForAppSession(context.Context, *SessionID) (*AppSessionSeqNum, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSeqNumForAppSession not implemented") -} func (UnimplementedWebApiServer) GetBlockNumber(context.Context, *emptypb.Empty) (*BlockNumber, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBlockNumber not implemented") } func (UnimplementedWebApiServer) SetMsgDropper(context.Context, *SetMsgDropReq) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method SetMsgDropper not implemented") } +func (UnimplementedWebApiServer) mustEmbedUnimplementedWebApiServer() {} // UnsafeWebApiServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to WebApiServer will @@ -1552,81 +1292,6 @@ func _WebApi_CreateAppSessionOnVirtualContract_Handler(srv interface{}, ctx cont return interceptor(ctx, in, info, handler) } -func _WebApi_CreateAppSessionOnDeployedContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateAppSessionOnDeployedContractRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).CreateAppSessionOnDeployedContract(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/CreateAppSessionOnDeployedContract", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).CreateAppSessionOnDeployedContract(ctx, req.(*CreateAppSessionOnDeployedContractRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_SubscribeAppSessionDispute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(SessionID) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(WebApiServer).SubscribeAppSessionDispute(m, &webApiSubscribeAppSessionDisputeServer{stream}) -} - -type WebApi_SubscribeAppSessionDisputeServer interface { - Send(*DisputeInfo) error - grpc.ServerStream -} - -type webApiSubscribeAppSessionDisputeServer struct { - grpc.ServerStream -} - -func (x *webApiSubscribeAppSessionDisputeServer) Send(m *DisputeInfo) error { - return x.ServerStream.SendMsg(m) -} - -func _WebApi_SignOutgoingState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SignOutgoingStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).SignOutgoingState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/SignOutgoingState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).SignOutgoingState(ctx, req.(*SignOutgoingStateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_ValidateAck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateAckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).ValidateAck(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/ValidateAck", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).ValidateAck(ctx, req.(*ValidateAckRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _WebApi_SignData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Data) if err := dec(in); err != nil { @@ -1645,114 +1310,6 @@ func _WebApi_SignData_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _WebApi_ProcessReceivedState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ProcessReceivedStateRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).ProcessReceivedState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/ProcessReceivedState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).ProcessReceivedState(ctx, req.(*ProcessReceivedStateRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_SettleAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettleAppSessionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).SettleAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/SettleAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).SettleAppSession(ctx, req.(*SettleAppSessionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_SettleAppSessionBySigTimeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettleAppSessionByTimeoutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).SettleAppSessionBySigTimeout(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/SettleAppSessionBySigTimeout", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).SettleAppSessionBySigTimeout(ctx, req.(*SettleAppSessionByTimeoutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_SettleAppSessionByMoveTimeout_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettleAppSessionByTimeoutRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).SettleAppSessionByMoveTimeout(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/SettleAppSessionByMoveTimeout", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).SettleAppSessionByMoveTimeout(ctx, req.(*SettleAppSessionByTimeoutRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_SettleAppSessionByInvalidTurn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettleAppSessionByInvalidityRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).SettleAppSessionByInvalidTurn(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/SettleAppSessionByInvalidTurn", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).SettleAppSessionByInvalidTurn(ctx, req.(*SettleAppSessionByInvalidityRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_SettleAppSessionByInvalidState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettleAppSessionByInvalidityRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).SettleAppSessionByInvalidState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/SettleAppSessionByInvalidState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).SettleAppSessionByInvalidState(ctx, req.(*SettleAppSessionByInvalidityRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _WebApi_DeleteAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(SessionID) if err := dec(in); err != nil { @@ -1807,132 +1364,6 @@ func _WebApi_GetBooleanOutcomeForAppSession_Handler(srv interface{}, ctx context return interceptor(ctx, in, info, handler) } -func _WebApi_ApplyActionForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ApplyActionForAppSessionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).ApplyActionForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/ApplyActionForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).ApplyActionForAppSession(ctx, req.(*ApplyActionForAppSessionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_FinalizeOnActionTimeoutForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SessionID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).FinalizeOnActionTimeoutForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/FinalizeOnActionTimeoutForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).FinalizeOnActionTimeoutForAppSession(ctx, req.(*SessionID)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_GetSettleFinalizedTimeForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SessionID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).GetSettleFinalizedTimeForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/GetSettleFinalizedTimeForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).GetSettleFinalizedTimeForAppSession(ctx, req.(*SessionID)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_GetActionDeadlineForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SessionID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).GetActionDeadlineForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/GetActionDeadlineForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).GetActionDeadlineForAppSession(ctx, req.(*SessionID)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_GetStatusForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SessionID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).GetStatusForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/GetStatusForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).GetStatusForAppSession(ctx, req.(*SessionID)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_GetStateForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetStateForAppSessionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).GetStateForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/GetStateForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).GetStateForAppSession(ctx, req.(*GetStateForAppSessionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _WebApi_GetSeqNumForAppSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SessionID) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(WebApiServer).GetSeqNumForAppSession(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/webrpc.WebApi/GetSeqNumForAppSession", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(WebApiServer).GetSeqNumForAppSession(ctx, req.(*SessionID)) - } - return interceptor(ctx, in, info, handler) -} - func _WebApi_GetBlockNumber_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { @@ -2097,46 +1528,10 @@ var _WebApi_serviceDesc = grpc.ServiceDesc{ MethodName: "CreateAppSessionOnVirtualContract", Handler: _WebApi_CreateAppSessionOnVirtualContract_Handler, }, - { - MethodName: "CreateAppSessionOnDeployedContract", - Handler: _WebApi_CreateAppSessionOnDeployedContract_Handler, - }, - { - MethodName: "SignOutgoingState", - Handler: _WebApi_SignOutgoingState_Handler, - }, - { - MethodName: "ValidateAck", - Handler: _WebApi_ValidateAck_Handler, - }, { MethodName: "SignData", Handler: _WebApi_SignData_Handler, }, - { - MethodName: "ProcessReceivedState", - Handler: _WebApi_ProcessReceivedState_Handler, - }, - { - MethodName: "SettleAppSession", - Handler: _WebApi_SettleAppSession_Handler, - }, - { - MethodName: "SettleAppSessionBySigTimeout", - Handler: _WebApi_SettleAppSessionBySigTimeout_Handler, - }, - { - MethodName: "SettleAppSessionByMoveTimeout", - Handler: _WebApi_SettleAppSessionByMoveTimeout_Handler, - }, - { - MethodName: "SettleAppSessionByInvalidTurn", - Handler: _WebApi_SettleAppSessionByInvalidTurn_Handler, - }, - { - MethodName: "SettleAppSessionByInvalidState", - Handler: _WebApi_SettleAppSessionByInvalidState_Handler, - }, { MethodName: "DeleteAppSession", Handler: _WebApi_DeleteAppSession_Handler, @@ -2149,34 +1544,6 @@ var _WebApi_serviceDesc = grpc.ServiceDesc{ MethodName: "GetBooleanOutcomeForAppSession", Handler: _WebApi_GetBooleanOutcomeForAppSession_Handler, }, - { - MethodName: "ApplyActionForAppSession", - Handler: _WebApi_ApplyActionForAppSession_Handler, - }, - { - MethodName: "FinalizeOnActionTimeoutForAppSession", - Handler: _WebApi_FinalizeOnActionTimeoutForAppSession_Handler, - }, - { - MethodName: "GetSettleFinalizedTimeForAppSession", - Handler: _WebApi_GetSettleFinalizedTimeForAppSession_Handler, - }, - { - MethodName: "GetActionDeadlineForAppSession", - Handler: _WebApi_GetActionDeadlineForAppSession_Handler, - }, - { - MethodName: "GetStatusForAppSession", - Handler: _WebApi_GetStatusForAppSession_Handler, - }, - { - MethodName: "GetStateForAppSession", - Handler: _WebApi_GetStateForAppSession_Handler, - }, - { - MethodName: "GetSeqNumForAppSession", - Handler: _WebApi_GetSeqNumForAppSession_Handler, - }, { MethodName: "GetBlockNumber", Handler: _WebApi_GetBlockNumber_Handler, @@ -2197,11 +1564,6 @@ var _WebApi_serviceDesc = grpc.ServiceDesc{ Handler: _WebApi_SubscribeOutgoingPayments_Handler, ServerStreams: true, }, - { - StreamName: "SubscribeAppSessionDispute", - Handler: _WebApi_SubscribeAppSessionDispute_Handler, - ServerStreams: true, - }, }, Metadata: "web_api.proto", }