diff --git a/Makefile b/Makefile index 7aab8d7..04eb9b7 100644 --- a/Makefile +++ b/Makefile @@ -20,5 +20,8 @@ build-run: build run clear-db: KV_VIPER_FILE=$(VIPER_FILE) signer migrate down +migrate-db: + KV_VIPER_FILE=$(VIPER_FILE) signer migrate up + test: KV_VIPER_FILE=$(VIPER_FILE) go test -count=1 $(TESTING_PACKAGES) diff --git a/contracts/bridge.go b/contracts/bridge.go index 15588dc..9790271 100644 --- a/contracts/bridge.go +++ b/contracts/bridge.go @@ -31,7 +31,7 @@ var ( // BridgeMetaData contains all meta data concerning the Bridge contract. var BridgeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"srcAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"dstAddress\",\"type\":\"string\"}],\"name\":\"BridgeIn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"originTxId\",\"type\":\"string\"}],\"name\":\"BridgeOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"addToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_dst\",\"type\":\"string\"}],\"name\":\"bridgeIn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_originTxId\",\"type\":\"string\"}],\"name\":\"bridgeOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"removeToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"setOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"srcAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"dstAddress\",\"type\":\"string\"}],\"name\":\"BridgeIn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"dstAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"originTxId\",\"type\":\"string\"}],\"name\":\"BridgeOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowList\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_dst\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"_isWrapped\",\"type\":\"bool\"}],\"name\":\"bridgeIn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_dst\",\"type\":\"string\"}],\"name\":\"bridgeInNative\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_originTxId\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"_isWrapped\",\"type\":\"bool\"}],\"name\":\"bridgeOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"_originTxId\",\"type\":\"string\"}],\"name\":\"bridgeOutNative\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"operator\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // BridgeABI is the input ABI used to generate the binding from. @@ -180,6 +180,37 @@ func (_Bridge *BridgeTransactorRaw) Transact(opts *bind.TransactOpts, method str return _Bridge.Contract.contract.Transact(opts, method, params...) } +// AllowList is a free data retrieval call binding the contract method 0x2848aeaf. +// +// Solidity: function allowList(address ) view returns(bool) +func (_Bridge *BridgeCaller) AllowList(opts *bind.CallOpts, arg0 common.Address) (bool, error) { + var out []interface{} + err := _Bridge.contract.Call(opts, &out, "allowList", arg0) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// AllowList is a free data retrieval call binding the contract method 0x2848aeaf. +// +// Solidity: function allowList(address ) view returns(bool) +func (_Bridge *BridgeSession) AllowList(arg0 common.Address) (bool, error) { + return _Bridge.Contract.AllowList(&_Bridge.CallOpts, arg0) +} + +// AllowList is a free data retrieval call binding the contract method 0x2848aeaf. +// +// Solidity: function allowList(address ) view returns(bool) +func (_Bridge *BridgeCallerSession) AllowList(arg0 common.Address) (bool, error) { + return _Bridge.Contract.AllowList(&_Bridge.CallOpts, arg0) +} + // Operator is a free data retrieval call binding the contract method 0x570ca735. // // Solidity: function operator() view returns(address) @@ -242,88 +273,88 @@ func (_Bridge *BridgeCallerSession) Owner() (common.Address, error) { return _Bridge.Contract.Owner(&_Bridge.CallOpts) } -// AddToken is a paid mutator transaction binding the contract method 0xd48bfca7. +// BridgeIn is a paid mutator transaction binding the contract method 0x4a5368bf. // -// Solidity: function addToken(address _token) returns() -func (_Bridge *BridgeTransactor) AddToken(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "addToken", _token) +// Solidity: function bridgeIn(address _token, uint256 _amount, uint256 _chainId, string _dst, bool _isWrapped) returns() +func (_Bridge *BridgeTransactor) BridgeIn(opts *bind.TransactOpts, _token common.Address, _amount *big.Int, _chainId *big.Int, _dst string, _isWrapped bool) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "bridgeIn", _token, _amount, _chainId, _dst, _isWrapped) } -// AddToken is a paid mutator transaction binding the contract method 0xd48bfca7. +// BridgeIn is a paid mutator transaction binding the contract method 0x4a5368bf. // -// Solidity: function addToken(address _token) returns() -func (_Bridge *BridgeSession) AddToken(_token common.Address) (*types.Transaction, error) { - return _Bridge.Contract.AddToken(&_Bridge.TransactOpts, _token) +// Solidity: function bridgeIn(address _token, uint256 _amount, uint256 _chainId, string _dst, bool _isWrapped) returns() +func (_Bridge *BridgeSession) BridgeIn(_token common.Address, _amount *big.Int, _chainId *big.Int, _dst string, _isWrapped bool) (*types.Transaction, error) { + return _Bridge.Contract.BridgeIn(&_Bridge.TransactOpts, _token, _amount, _chainId, _dst, _isWrapped) } -// AddToken is a paid mutator transaction binding the contract method 0xd48bfca7. +// BridgeIn is a paid mutator transaction binding the contract method 0x4a5368bf. // -// Solidity: function addToken(address _token) returns() -func (_Bridge *BridgeTransactorSession) AddToken(_token common.Address) (*types.Transaction, error) { - return _Bridge.Contract.AddToken(&_Bridge.TransactOpts, _token) +// Solidity: function bridgeIn(address _token, uint256 _amount, uint256 _chainId, string _dst, bool _isWrapped) returns() +func (_Bridge *BridgeTransactorSession) BridgeIn(_token common.Address, _amount *big.Int, _chainId *big.Int, _dst string, _isWrapped bool) (*types.Transaction, error) { + return _Bridge.Contract.BridgeIn(&_Bridge.TransactOpts, _token, _amount, _chainId, _dst, _isWrapped) } -// BridgeIn is a paid mutator transaction binding the contract method 0x3a678fc5. +// BridgeInNative is a paid mutator transaction binding the contract method 0x93ce02da. // -// Solidity: function bridgeIn(address _token, uint256 _amount, uint256 _chainId, string _dst) returns() -func (_Bridge *BridgeTransactor) BridgeIn(opts *bind.TransactOpts, _token common.Address, _amount *big.Int, _chainId *big.Int, _dst string) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "bridgeIn", _token, _amount, _chainId, _dst) +// Solidity: function bridgeInNative(uint256 _chainId, string _dst) payable returns() +func (_Bridge *BridgeTransactor) BridgeInNative(opts *bind.TransactOpts, _chainId *big.Int, _dst string) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "bridgeInNative", _chainId, _dst) } -// BridgeIn is a paid mutator transaction binding the contract method 0x3a678fc5. +// BridgeInNative is a paid mutator transaction binding the contract method 0x93ce02da. // -// Solidity: function bridgeIn(address _token, uint256 _amount, uint256 _chainId, string _dst) returns() -func (_Bridge *BridgeSession) BridgeIn(_token common.Address, _amount *big.Int, _chainId *big.Int, _dst string) (*types.Transaction, error) { - return _Bridge.Contract.BridgeIn(&_Bridge.TransactOpts, _token, _amount, _chainId, _dst) +// Solidity: function bridgeInNative(uint256 _chainId, string _dst) payable returns() +func (_Bridge *BridgeSession) BridgeInNative(_chainId *big.Int, _dst string) (*types.Transaction, error) { + return _Bridge.Contract.BridgeInNative(&_Bridge.TransactOpts, _chainId, _dst) } -// BridgeIn is a paid mutator transaction binding the contract method 0x3a678fc5. +// BridgeInNative is a paid mutator transaction binding the contract method 0x93ce02da. // -// Solidity: function bridgeIn(address _token, uint256 _amount, uint256 _chainId, string _dst) returns() -func (_Bridge *BridgeTransactorSession) BridgeIn(_token common.Address, _amount *big.Int, _chainId *big.Int, _dst string) (*types.Transaction, error) { - return _Bridge.Contract.BridgeIn(&_Bridge.TransactOpts, _token, _amount, _chainId, _dst) +// Solidity: function bridgeInNative(uint256 _chainId, string _dst) payable returns() +func (_Bridge *BridgeTransactorSession) BridgeInNative(_chainId *big.Int, _dst string) (*types.Transaction, error) { + return _Bridge.Contract.BridgeInNative(&_Bridge.TransactOpts, _chainId, _dst) } -// BridgeOut is a paid mutator transaction binding the contract method 0x7eceb981. +// BridgeOut is a paid mutator transaction binding the contract method 0xb9fe6843. // -// Solidity: function bridgeOut(address _token, address _receiver, uint256 _amount, string _originTxId) returns() -func (_Bridge *BridgeTransactor) BridgeOut(opts *bind.TransactOpts, _token common.Address, _receiver common.Address, _amount *big.Int, _originTxId string) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "bridgeOut", _token, _receiver, _amount, _originTxId) +// Solidity: function bridgeOut(address _token, address _receiver, uint256 _amount, string _originTxId, bool _isWrapped) returns() +func (_Bridge *BridgeTransactor) BridgeOut(opts *bind.TransactOpts, _token common.Address, _receiver common.Address, _amount *big.Int, _originTxId string, _isWrapped bool) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "bridgeOut", _token, _receiver, _amount, _originTxId, _isWrapped) } -// BridgeOut is a paid mutator transaction binding the contract method 0x7eceb981. +// BridgeOut is a paid mutator transaction binding the contract method 0xb9fe6843. // -// Solidity: function bridgeOut(address _token, address _receiver, uint256 _amount, string _originTxId) returns() -func (_Bridge *BridgeSession) BridgeOut(_token common.Address, _receiver common.Address, _amount *big.Int, _originTxId string) (*types.Transaction, error) { - return _Bridge.Contract.BridgeOut(&_Bridge.TransactOpts, _token, _receiver, _amount, _originTxId) +// Solidity: function bridgeOut(address _token, address _receiver, uint256 _amount, string _originTxId, bool _isWrapped) returns() +func (_Bridge *BridgeSession) BridgeOut(_token common.Address, _receiver common.Address, _amount *big.Int, _originTxId string, _isWrapped bool) (*types.Transaction, error) { + return _Bridge.Contract.BridgeOut(&_Bridge.TransactOpts, _token, _receiver, _amount, _originTxId, _isWrapped) } -// BridgeOut is a paid mutator transaction binding the contract method 0x7eceb981. +// BridgeOut is a paid mutator transaction binding the contract method 0xb9fe6843. // -// Solidity: function bridgeOut(address _token, address _receiver, uint256 _amount, string _originTxId) returns() -func (_Bridge *BridgeTransactorSession) BridgeOut(_token common.Address, _receiver common.Address, _amount *big.Int, _originTxId string) (*types.Transaction, error) { - return _Bridge.Contract.BridgeOut(&_Bridge.TransactOpts, _token, _receiver, _amount, _originTxId) +// Solidity: function bridgeOut(address _token, address _receiver, uint256 _amount, string _originTxId, bool _isWrapped) returns() +func (_Bridge *BridgeTransactorSession) BridgeOut(_token common.Address, _receiver common.Address, _amount *big.Int, _originTxId string, _isWrapped bool) (*types.Transaction, error) { + return _Bridge.Contract.BridgeOut(&_Bridge.TransactOpts, _token, _receiver, _amount, _originTxId, _isWrapped) } -// RemoveToken is a paid mutator transaction binding the contract method 0x5fa7b584. +// BridgeOutNative is a paid mutator transaction binding the contract method 0x07bb49bc. // -// Solidity: function removeToken(address _token) returns() -func (_Bridge *BridgeTransactor) RemoveToken(opts *bind.TransactOpts, _token common.Address) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "removeToken", _token) +// Solidity: function bridgeOutNative(address _receiver, uint256 _amount, string _originTxId) returns() +func (_Bridge *BridgeTransactor) BridgeOutNative(opts *bind.TransactOpts, _receiver common.Address, _amount *big.Int, _originTxId string) (*types.Transaction, error) { + return _Bridge.contract.Transact(opts, "bridgeOutNative", _receiver, _amount, _originTxId) } -// RemoveToken is a paid mutator transaction binding the contract method 0x5fa7b584. +// BridgeOutNative is a paid mutator transaction binding the contract method 0x07bb49bc. // -// Solidity: function removeToken(address _token) returns() -func (_Bridge *BridgeSession) RemoveToken(_token common.Address) (*types.Transaction, error) { - return _Bridge.Contract.RemoveToken(&_Bridge.TransactOpts, _token) +// Solidity: function bridgeOutNative(address _receiver, uint256 _amount, string _originTxId) returns() +func (_Bridge *BridgeSession) BridgeOutNative(_receiver common.Address, _amount *big.Int, _originTxId string) (*types.Transaction, error) { + return _Bridge.Contract.BridgeOutNative(&_Bridge.TransactOpts, _receiver, _amount, _originTxId) } -// RemoveToken is a paid mutator transaction binding the contract method 0x5fa7b584. +// BridgeOutNative is a paid mutator transaction binding the contract method 0x07bb49bc. // -// Solidity: function removeToken(address _token) returns() -func (_Bridge *BridgeTransactorSession) RemoveToken(_token common.Address) (*types.Transaction, error) { - return _Bridge.Contract.RemoveToken(&_Bridge.TransactOpts, _token) +// Solidity: function bridgeOutNative(address _receiver, uint256 _amount, string _originTxId) returns() +func (_Bridge *BridgeTransactorSession) BridgeOutNative(_receiver common.Address, _amount *big.Int, _originTxId string) (*types.Transaction, error) { + return _Bridge.Contract.BridgeOutNative(&_Bridge.TransactOpts, _receiver, _amount, _originTxId) } // RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. @@ -347,48 +378,6 @@ func (_Bridge *BridgeTransactorSession) RenounceOwnership() (*types.Transaction, return _Bridge.Contract.RenounceOwnership(&_Bridge.TransactOpts) } -// SendToken is a paid mutator transaction binding the contract method 0x2fdcfbd2. -// -// Solidity: function sendToken(address _token, address _receiver, uint256 _amount) returns() -func (_Bridge *BridgeTransactor) SendToken(opts *bind.TransactOpts, _token common.Address, _receiver common.Address, _amount *big.Int) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "sendToken", _token, _receiver, _amount) -} - -// SendToken is a paid mutator transaction binding the contract method 0x2fdcfbd2. -// -// Solidity: function sendToken(address _token, address _receiver, uint256 _amount) returns() -func (_Bridge *BridgeSession) SendToken(_token common.Address, _receiver common.Address, _amount *big.Int) (*types.Transaction, error) { - return _Bridge.Contract.SendToken(&_Bridge.TransactOpts, _token, _receiver, _amount) -} - -// SendToken is a paid mutator transaction binding the contract method 0x2fdcfbd2. -// -// Solidity: function sendToken(address _token, address _receiver, uint256 _amount) returns() -func (_Bridge *BridgeTransactorSession) SendToken(_token common.Address, _receiver common.Address, _amount *big.Int) (*types.Transaction, error) { - return _Bridge.Contract.SendToken(&_Bridge.TransactOpts, _token, _receiver, _amount) -} - -// SetOperator is a paid mutator transaction binding the contract method 0xb3ab15fb. -// -// Solidity: function setOperator(address _operator) returns() -func (_Bridge *BridgeTransactor) SetOperator(opts *bind.TransactOpts, _operator common.Address) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "setOperator", _operator) -} - -// SetOperator is a paid mutator transaction binding the contract method 0xb3ab15fb. -// -// Solidity: function setOperator(address _operator) returns() -func (_Bridge *BridgeSession) SetOperator(_operator common.Address) (*types.Transaction, error) { - return _Bridge.Contract.SetOperator(&_Bridge.TransactOpts, _operator) -} - -// SetOperator is a paid mutator transaction binding the contract method 0xb3ab15fb. -// -// Solidity: function setOperator(address _operator) returns() -func (_Bridge *BridgeTransactorSession) SetOperator(_operator common.Address) (*types.Transaction, error) { - return _Bridge.Contract.SetOperator(&_Bridge.TransactOpts, _operator) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() diff --git a/docs/static/service.swagger.json b/docs/static/service.swagger.json index 71878b6..6d85cb0 100644 --- a/docs/static/service.swagger.json +++ b/docs/static/service.swagger.json @@ -129,7 +129,7 @@ "depositor": { "type": "string" }, - "amount": { + "depositAmount": { "type": "string" }, "depositToken": { @@ -140,6 +140,12 @@ }, "withdrawalToken": { "type": "string" + }, + "isWrapped": { + "type": "boolean" + }, + "withdrawalAmount": { + "type": "string" } } }, diff --git a/go.mod b/go.mod index 6b422f5..c757d5e 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,8 @@ require ( github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/cosmos/gogoproto v1.5.0 github.com/ethereum/go-ethereum v1.10.26 - github.com/hyle-team/bridgeless-core v0.0.0-20240814124421-34bfbc7e857c + github.com/hyle-team/bridgeless-core v0.0.0-20240911163215-e9a1ef12c6da + github.com/lib/pq v1.10.9 github.com/rabbitmq/amqp091-go v1.10.0 github.com/spf13/cast v1.6.0 gitlab.com/distributed_lab/figure/v3 v3.1.4 @@ -100,7 +101,6 @@ require ( github.com/klauspost/compress v1.17.0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect - github.com/lib/pq v1.10.9 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.19 // indirect @@ -168,7 +168,8 @@ replace ( github.com/cosmos/iavl => github.com/cosmos/iavl v0.19.6 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - //github.com/hyle-team/bridgeless-core => /Users/slbmax/go/src/github.com/hyle-team/bridgeless-core + github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.29 github.com/tidwall/btree => github.com/tidwall/btree v1.5.0 + nhooyr.io/websocket => github.com/coder/websocket v1.8.7 ) diff --git a/go.sum b/go.sum index 538f9e7..376a3da 100644 --- a/go.sum +++ b/go.sum @@ -1321,6 +1321,8 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWH github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/coder/websocket v1.8.7 h1:jiep6gmlfP/yq2w1gBoubJEXL9gf8x3bp6lzzX8nJxE= +github.com/coder/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= github.com/cometbft/cometbft v0.34.29 h1:Q4FqMevP9du2pOgryZJHpDV2eA6jg/kMYxBj9ZTY6VQ= @@ -1782,8 +1784,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/hyle-team/bridgeless-core v0.0.0-20240814124421-34bfbc7e857c h1:fJsuw9PxH3FByVaS6BK78VeqCXW5ioZkToiOL9OJNjo= -github.com/hyle-team/bridgeless-core v0.0.0-20240814124421-34bfbc7e857c/go.mod h1:uOnrp+nR2tpLf8ehAo5oIa2/tK/MDn6OhfBOcjJ0weY= +github.com/hyle-team/bridgeless-core v0.0.0-20240911163215-e9a1ef12c6da h1:r7V5qDnd+6AIaMSx463+mq8vhMrY8p2NxQWzPgHBGew= +github.com/hyle-team/bridgeless-core v0.0.0-20240911163215-e9a1ef12c6da/go.mod h1:E416XZ8/nZ4Te3gzqYFcasErEvv8JHXpR9nMBMdxLI8= github.com/hyle-team/cosmos-sdk v0.46.20 h1:2pd+6xOEf3c9CgIG2be/Rl3X3wAuTwL+hJT5v+33Db4= github.com/hyle-team/cosmos-sdk v0.46.20/go.mod h1:nIfy+qNyHSoV2b901hNglQNVvHGK/9vrnMlgJU6SsIM= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= @@ -3347,8 +3349,6 @@ modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= moul.io/http2curl/v2 v2.3.0/go.mod h1:RW4hyBjTWSYDOxapodpNEtX0g5Eb16sxklBqmd2RHcE= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/internal/assets/migrations/002_is_wrapped.sql b/internal/assets/migrations/002_is_wrapped.sql new file mode 100644 index 0000000..fd75ad3 --- /dev/null +++ b/internal/assets/migrations/002_is_wrapped.sql @@ -0,0 +1,9 @@ +-- +migrate Up + +ALTER TABLE deposits + ADD COLUMN is_wrapped_token boolean DEFAULT false; + +-- +migrate Down + +ALTER TABLE deposits + DROP COLUMN is_wrapped_token; \ No newline at end of file diff --git a/internal/assets/migrations/003_amount.sql b/internal/assets/migrations/003_amount.sql new file mode 100644 index 0000000..278c143 --- /dev/null +++ b/internal/assets/migrations/003_amount.sql @@ -0,0 +1,15 @@ +-- +migrate Up + +ALTER TABLE deposits + RENAME COLUMN amount TO deposit_amount; + +ALTER TABLE deposits + ADD COLUMN withdrawal_amount TEXT; + +-- +migrate Down + +ALTER TABLE deposits + RENAME COLUMN deposit_amount to amount; + +ALTER TABLE deposits + DROP COLUMN withdrawal_amount; \ No newline at end of file diff --git a/internal/connectors/core/config/config.go b/internal/bridge/core/config/config.go similarity index 97% rename from internal/connectors/core/config/config.go rename to internal/bridge/core/config/config.go index 9264c0a..2d36274 100644 --- a/internal/connectors/core/config/config.go +++ b/internal/bridge/core/config/config.go @@ -2,7 +2,7 @@ package config import ( "crypto/tls" - "github.com/hyle-team/bridgeless-signer/internal/connectors/core" + "github.com/hyle-team/bridgeless-signer/internal/bridge/core" pkgTypes "github.com/hyle-team/bridgeless-signer/pkg/types" "github.com/pkg/errors" "gitlab.com/distributed_lab/figure/v3" diff --git a/internal/connectors/core/main.go b/internal/bridge/core/main.go similarity index 80% rename from internal/connectors/core/main.go rename to internal/bridge/core/main.go index 575924f..fdf4831 100644 --- a/internal/connectors/core/main.go +++ b/internal/bridge/core/main.go @@ -7,23 +7,20 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + txclient "github.com/cosmos/cosmos-sdk/types/tx" "github.com/cosmos/cosmos-sdk/types/tx/signing" authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing" authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" - "github.com/ethereum/go-ethereum/common" - "github.com/hyle-team/bridgeless-signer/pkg/tokens" - pkgTypes "github.com/hyle-team/bridgeless-signer/pkg/types" - "github.com/pkg/errors" - "google.golang.org/grpc" - "strings" - - txclient "github.com/cosmos/cosmos-sdk/types/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" coretypes "github.com/hyle-team/bridgeless-core/types" bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" + "github.com/hyle-team/bridgeless-signer/internal/bridge/types" + pkgTypes "github.com/hyle-team/bridgeless-signer/pkg/types" + "github.com/pkg/errors" + "google.golang.org/grpc" ) -var _ tokens.TokenPairer = &Connector{} +var _ types.Bridger = &Connector{} type ConnectorSettings struct { Account pkgTypes.Account `fig:"account_private_key,required"` @@ -36,7 +33,7 @@ type Connector struct { transactor txclient.ServiceClient txConfiger sdkclient.TxConfig auther authtypes.QueryClient - bridger bridgetypes.QueryClient + querier bridgetypes.QueryClient settings ConnectorSettings } @@ -46,45 +43,11 @@ func NewConnector(conn *grpc.ClientConn, settings ConnectorSettings) *Connector transactor: txclient.NewServiceClient(conn), txConfiger: authtx.NewTxConfig(codec.NewProtoCodec(codectypes.NewInterfaceRegistry()), []signing.SignMode{signing.SignMode_SIGN_MODE_DIRECT}), auther: authtypes.NewQueryClient(conn), - bridger: bridgetypes.NewQueryClient(conn), + querier: bridgetypes.NewQueryClient(conn), settings: settings, } } -func (c *Connector) GetDestinationTokenAddress( - srcChainId string, - srcTokenAddr common.Address, - dstChainId string, -) (common.Address, error) { - req := bridgetypes.QueryGetTokenPair{ - SrcChain: srcChainId, - SrcAddress: strings.ToLower(srcTokenAddr.String()), - DstChain: dstChainId, - } - - resp, err := c.bridger.GetTokenPair(context.Background(), &req) - if err != nil { - if errors.Is(bridgetypes.ErrTokenPairNotFound.GRPCStatus().Err(), err) { - return common.Address{}, tokens.ErrPairNotFound - } - - return common.Address{}, errors.Wrap(err, "failed to get token pair") - } - - return common.HexToAddress(resp.Info.Address), nil - -} - -func (c *Connector) SubmitDeposits(depositTxs ...bridgetypes.Transaction) error { - if len(depositTxs) == 0 { - return nil - } - - msg := bridgetypes.NewMsgSubmitTransactions(c.settings.Account.CosmosAddress(), depositTxs...) - - return c.submitMsgs(msg) -} - func (c *Connector) submitMsgs(msgs ...sdk.Msg) error { if len(msgs) == 0 { return nil diff --git a/internal/bridge/core/submit_tx.go b/internal/bridge/core/submit_tx.go new file mode 100644 index 0000000..809db73 --- /dev/null +++ b/internal/bridge/core/submit_tx.go @@ -0,0 +1,13 @@ +package core + +import bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" + +func (c *Connector) SubmitDeposits(depositTxs ...bridgetypes.Transaction) error { + if len(depositTxs) == 0 { + return nil + } + + msg := bridgetypes.NewMsgSubmitTransactions(c.settings.Account.CosmosAddress(), depositTxs...) + + return c.submitMsgs(msg) +} diff --git a/internal/bridge/core/token_info.go b/internal/bridge/core/token_info.go new file mode 100644 index 0000000..d7f4a82 --- /dev/null +++ b/internal/bridge/core/token_info.go @@ -0,0 +1,25 @@ +package core + +import ( + "context" + bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" + "github.com/pkg/errors" +) + +func (c *Connector) GetTokenInfo(chainId string, addr string) (bridgetypes.TokenInfo, error) { + req := bridgetypes.QueryGetTokenInfo{ + Chain: chainId, + Address: addr, + } + + resp, err := c.querier.GetTokenInfo(context.Background(), &req) + if err != nil { + if errors.Is(err, bridgetypes.ErrTokenInfoNotFound.GRPCStatus().Err()) { + return bridgetypes.TokenInfo{}, bridgetypes.ErrTokenInfoNotFound + } + + return bridgetypes.TokenInfo{}, errors.Wrap(err, "failed to get token info") + } + + return resp.Info, nil +} diff --git a/internal/bridge/core/token_pair.go b/internal/bridge/core/token_pair.go new file mode 100644 index 0000000..ff7565e --- /dev/null +++ b/internal/bridge/core/token_pair.go @@ -0,0 +1,34 @@ +package core + +import ( + "context" + "github.com/ethereum/go-ethereum/common" + bridgetypes "github.com/hyle-team/bridgeless-core/x/bridge/types" + "github.com/hyle-team/bridgeless-signer/internal/bridge/types" + "github.com/pkg/errors" + "strings" +) + +func (c *Connector) GetDestinationTokenInfo( + srcChainId string, + srcTokenAddr common.Address, + dstChainId string, +) (bridgetypes.TokenInfo, error) { + req := bridgetypes.QueryGetTokenPair{ + SrcChain: srcChainId, + SrcAddress: strings.ToLower(srcTokenAddr.String()), + DstChain: dstChainId, + } + + resp, err := c.querier.GetTokenPair(context.Background(), &req) + if err != nil { + if errors.Is(err, bridgetypes.ErrTokenPairNotFound.GRPCStatus().Err()) { + return bridgetypes.TokenInfo{}, types.ErrPairNotFound + } + + return bridgetypes.TokenInfo{}, errors.Wrap(err, "failed to get token pair") + } + + return resp.Info, nil + +} diff --git a/internal/connectors/core/utils.go b/internal/bridge/core/utils.go similarity index 100% rename from internal/connectors/core/utils.go rename to internal/bridge/core/utils.go diff --git a/internal/bridge/processor/get_deposit.go b/internal/bridge/processor/get_deposit.go index 6f8116c..936aeb0 100644 --- a/internal/bridge/processor/get_deposit.go +++ b/internal/bridge/processor/get_deposit.go @@ -2,9 +2,8 @@ package processor import ( "fmt" - "github.com/hyle-team/bridgeless-signer/internal/bridge/proxy/btc" + "github.com/ethereum/go-ethereum/common" bridgeTypes "github.com/hyle-team/bridgeless-signer/internal/bridge/types" - "github.com/hyle-team/bridgeless-signer/pkg/tokens" "github.com/pkg/errors" ) @@ -28,7 +27,6 @@ func (p *Processor) ProcessGetDepositRequest(req bridgeTypes.GetDepositRequest) errors.Is(err, bridgeTypes.ErrInvalidScriptPubKey) { reprocessable = false } - return nil, reprocessable, errors.Wrap(err, "failed to get deposit data") } @@ -43,31 +41,35 @@ func (p *Processor) ProcessGetDepositRequest(req bridgeTypes.GetDepositRequest) return data, false, errors.Wrap(bridgeTypes.ErrInvalidReceiverAddress, depositData.DestinationAddress) } - switch dstProxy.Type() { - case bridgeTypes.ChainTypeBitcoin: - if depositData.Amount.Int64() < btc.MinSatoshisPerOutput { - return data, false, bridgeTypes.ErrInvalidDepositedAmount + srcTokenInfo, err := p.core.GetTokenInfo(depositData.ChainId, depositData.TokenAddress.String()) + if err != nil { + reprocessable = true + if errors.Is(err, bridgeTypes.ErrTokenInfoNotFound) { + reprocessable = false } - case bridgeTypes.ChainTypeEVM: - depositData.DestinationTokenAddress, err = p.tokenPairer.GetDestinationTokenAddress( - depositData.ChainId, - depositData.TokenAddress, - depositData.DestinationChainId, - ) - if err != nil { - reprocessable = true - if errors.Is(err, tokens.ErrSourceTokenNotSupported) || - errors.Is(err, tokens.ErrDestinationTokenNotSupported) || - errors.Is(err, tokens.ErrPairNotFound) { - reprocessable = false - } - - return nil, reprocessable, errors.Wrap(err, "failed to get destination token address") + return nil, reprocessable, errors.Wrap(err, "failed to get source token info") + } + dstTokenInfo, err := p.core.GetDestinationTokenInfo( + depositData.ChainId, + depositData.TokenAddress, + depositData.DestinationChainId, + ) + if err != nil { + reprocessable = true + if errors.Is(err, bridgeTypes.ErrPairNotFound) { + reprocessable = false } - default: - return data, false, errors.Wrap(err, fmt.Sprintf("invalid chain type: %v", dstProxy.Type())) + return nil, reprocessable, errors.Wrap(err, "failed to get destination token info") } + depositData.WithdrawalAmount = transformAmount(depositData.DepositAmount, srcTokenInfo.Decimals, dstTokenInfo.Decimals) + if !dstProxy.WithdrawalAmountValid(depositData.WithdrawalAmount) { + return nil, false, bridgeTypes.ErrInvalidDepositedAmount + } + + depositData.DestinationTokenAddress = common.HexToAddress(dstTokenInfo.Address) + depositData.IsWrappedToken = dstTokenInfo.IsWrapped + if err = p.db.New().SetDepositData(*depositData); err != nil { return nil, true, errors.Wrap(err, "failed to save deposit data") } diff --git a/internal/bridge/processor/main.go b/internal/bridge/processor/main.go index ec73178..dda0614 100644 --- a/internal/bridge/processor/main.go +++ b/internal/bridge/processor/main.go @@ -1,36 +1,28 @@ package processor import ( - coretypes "github.com/hyle-team/bridgeless-core/x/bridge/types" "github.com/hyle-team/bridgeless-signer/internal/bridge/signer" bridgeTypes "github.com/hyle-team/bridgeless-signer/internal/bridge/types" "github.com/hyle-team/bridgeless-signer/internal/data" - "github.com/hyle-team/bridgeless-signer/pkg/tokens" "github.com/hyle-team/bridgeless-signer/pkg/types" "github.com/pkg/errors" ) -type TxSubmitter interface { - SubmitDeposits(depositTxs ...coretypes.Transaction) error -} - type Processor struct { - proxies bridgeTypes.ProxiesRepository - db data.DepositsQ - signer *signer.Signer - tokenPairer tokens.TokenPairer - submitter TxSubmitter + proxies bridgeTypes.ProxiesRepository + db data.DepositsQ + signer *signer.Signer + core bridgeTypes.Bridger } func New( proxies bridgeTypes.ProxiesRepository, db data.DepositsQ, signer *signer.Signer, - tokenPairer tokens.TokenPairer, - submitter TxSubmitter, + core bridgeTypes.Bridger, ) *Processor { - return &Processor{proxies: proxies, db: db, signer: signer, tokenPairer: tokenPairer, submitter: submitter} + return &Processor{proxies: proxies, db: db, signer: signer, core: core} } func (p *Processor) SetWithdrawStatusFailed(ids ...int64) error { diff --git a/internal/bridge/processor/send_bitcoin_withdraw.go b/internal/bridge/processor/send_bitcoin_withdraw.go index 18f822d..17abddf 100644 --- a/internal/bridge/processor/send_bitcoin_withdraw.go +++ b/internal/bridge/processor/send_bitcoin_withdraw.go @@ -18,7 +18,7 @@ func (p *Processor) SendBitcoinWithdrawals(reqs ...bridgeTypes.BitcoinWithdrawal depositIds = make([]int64, len(reqs)) ) for i, req := range reqs { - params[req.Data.DestinationAddress] = req.Data.Amount + params[req.Data.DestinationAddress] = req.Data.WithdrawalAmount depositIds[i] = req.DepositDbId } diff --git a/internal/bridge/processor/submit_transaction.go b/internal/bridge/processor/submit_transaction.go index 111d997..bc06049 100644 --- a/internal/bridge/processor/submit_transaction.go +++ b/internal/bridge/processor/submit_transaction.go @@ -36,7 +36,7 @@ func (p *Processor) SubmitTransactions(reqs ...bridgeTypes.SubmitTransactionRequ return errors.Wrap(tmperr, "failed to set deposits submitted") } - return errors.Wrap(p.submitter.SubmitDeposits(depositTxs...), "failed to submit deposits") + return errors.Wrap(p.core.SubmitDeposits(depositTxs...), "failed to submit deposits") }) return err != nil, err diff --git a/internal/bridge/processor/utils.go b/internal/bridge/processor/utils.go new file mode 100644 index 0000000..499157e --- /dev/null +++ b/internal/bridge/processor/utils.go @@ -0,0 +1,23 @@ +package processor + +import "math/big" + +func transformAmount(amount *big.Int, currentDecimals uint64, targetDecimals uint64) *big.Int { + result, _ := new(big.Int).SetString(amount.String(), 10) + + if currentDecimals == targetDecimals { + return result + } + + if currentDecimals < targetDecimals { + for i := uint64(0); i < targetDecimals-currentDecimals; i++ { + result.Mul(result, new(big.Int).SetInt64(10)) + } + } else { + for i := uint64(0); i < currentDecimals-targetDecimals; i++ { + result.Div(result, new(big.Int).SetInt64(10)) + } + } + + return result +} diff --git a/internal/bridge/processor/utils_test.go b/internal/bridge/processor/utils_test.go new file mode 100644 index 0000000..98919fc --- /dev/null +++ b/internal/bridge/processor/utils_test.go @@ -0,0 +1,55 @@ +package processor + +import ( + "github.com/stretchr/testify/require" + "math/big" + "testing" +) + +func Test_TransformAmount(t *testing.T) { + type tc struct { + amount *big.Int + cDec, tDec uint64 + expected *big.Int + } + + testCases := map[string]tc{ + "should not change": { + amount: big.NewInt(100), + cDec: 1, + tDec: 1, + expected: big.NewInt(100), + }, + "should transform correctly (target is larger that current)": { + amount: big.NewInt(100_000_000), + cDec: 6, + tDec: 12, + expected: big.NewInt(100_000_000_000_000), + }, + "should transform correctly (target is smaller that current)": { + amount: big.NewInt(100_000_000_000_000_000), + cDec: 15, + tDec: 6, + expected: big.NewInt(100_000_000), + }, + "should transform correctly (target is much bigger than current)": { + amount: big.NewInt(100), + cDec: 6, + tDec: 18, + expected: big.NewInt(100_000_000_000_000), + }, + "should transform to zero (target is much lower that current)": { + amount: big.NewInt(100_000), + cDec: 18, + tDec: 6, + expected: big.NewInt(0), + }, + } + + for name, tCase := range testCases { + t.Run(name, func(t *testing.T) { + result := transformAmount(tCase.amount, tCase.cDec, tCase.tDec) + require.Equal(t, tCase.expected.String(), result.String()) + }) + } +} diff --git a/internal/bridge/proxy/btc/deposit.go b/internal/bridge/proxy/btc/deposit.go index cf701d5..826df84 100644 --- a/internal/bridge/proxy/btc/deposit.go +++ b/internal/bridge/proxy/btc/deposit.go @@ -70,7 +70,7 @@ func (p *proxy) GetDepositData(id data.DepositIdentifier) (*data.DepositData, er DestinationChainId: chainId, DestinationAddress: addr, SourceAddress: depositor, - Amount: amount, + DepositAmount: amount, // no token address here Block: block.Height, }, nil diff --git a/internal/bridge/proxy/btc/proxy.go b/internal/bridge/proxy/btc/proxy.go index 550e2ca..7ce9ca3 100644 --- a/internal/bridge/proxy/btc/proxy.go +++ b/internal/bridge/proxy/btc/proxy.go @@ -9,8 +9,8 @@ import ( "regexp" ) -// MinSatoshisPerOutput calculated for P2PKH -const MinSatoshisPerOutput = 547 +// minSatoshisPerOutput calculated for P2PKH +const minSatoshisPerOutput = 547 var txHashPattern = regexp.MustCompile("^[a-fA-F0-9]{64}$") diff --git a/internal/bridge/proxy/btc/withdraw.go b/internal/bridge/proxy/btc/withdraw.go index a921e52..2acd502 100644 --- a/internal/bridge/proxy/btc/withdraw.go +++ b/internal/bridge/proxy/btc/withdraw.go @@ -21,7 +21,7 @@ func (p *proxy) SendBitcoins(data map[string]*big.Int) (string, error) { return "", errors.New("amount is nil") } value := amount.Int64() - if value < MinSatoshisPerOutput { + if value < minSatoshisPerOutput { return "", errors.New("amount is too small") } @@ -35,3 +35,11 @@ func (p *proxy) SendBitcoins(data map[string]*big.Int) (string, error) { return hash.String(), nil } + +func (p *proxy) WithdrawalAmountValid(amount *big.Int) bool { + if amount.Cmp(big.NewInt(minSatoshisPerOutput)) == -1 { + return false + } + + return true +} diff --git a/internal/bridge/proxy/evm/deposit.go b/internal/bridge/proxy/evm/deposit.go index c21f3c0..39406cb 100644 --- a/internal/bridge/proxy/evm/deposit.go +++ b/internal/bridge/proxy/evm/deposit.go @@ -45,7 +45,7 @@ func (p *proxy) GetDepositData(id data.DepositIdentifier) (*data.DepositData, er DestinationChainId: event.ChainId.String(), DestinationAddress: event.DstAddress, SourceAddress: event.SrcAddress.String(), - Amount: event.Amount, + DepositAmount: event.Amount, TokenAddress: event.Token, Block: int64(log.BlockNumber), }, nil diff --git a/internal/bridge/proxy/evm/proxy.go b/internal/bridge/proxy/evm/proxy.go index e390dc3..b8dde79 100644 --- a/internal/bridge/proxy/evm/proxy.go +++ b/internal/bridge/proxy/evm/proxy.go @@ -77,7 +77,7 @@ func (p *proxy) isDepositLog(log *types.Log) bool { } func (p *proxy) AddressValid(addr string) bool { - return common.IsHexAddress(addr) && common.HexToAddress(addr) != (common.Address{}) + return common.IsHexAddress(addr) } func (p *proxy) SendBitcoins(map[string]*big.Int) (txHash string, err error) { diff --git a/internal/bridge/proxy/evm/utils.go b/internal/bridge/proxy/evm/utils.go new file mode 100644 index 0000000..9c3b787 --- /dev/null +++ b/internal/bridge/proxy/evm/utils.go @@ -0,0 +1,10 @@ +package evm + +import ( + "bytes" + "github.com/ethereum/go-ethereum/common" +) + +func IsAddressEmpty(addr common.Address) bool { + return bytes.Equal(addr.Bytes(), new(common.Address).Bytes()) +} diff --git a/internal/bridge/proxy/evm/withdraw.go b/internal/bridge/proxy/evm/withdraw.go index 7efb448..bd44980 100644 --- a/internal/bridge/proxy/evm/withdraw.go +++ b/internal/bridge/proxy/evm/withdraw.go @@ -9,15 +9,36 @@ import ( "math/big" ) +func (p *proxy) WithdrawalAmountValid(amount *big.Int) bool { + if amount.Cmp(big.NewInt(0)) != 1 { + return false + } + + return true +} + func (p *proxy) FormWithdrawalTransaction(data data.DepositData) (*types.Transaction, error) { // transact opts prevent the transaction from being sent to // the network, returning the transaction object only + + if IsAddressEmpty(data.DestinationTokenAddress) { + // If the address is empty, it indicates that the + // native token is being transferred. + return p.bridgeContract.BridgeOutNative( + bridgeOutTransactOpts(p.getTransactionNonce()), + common.HexToAddress(data.DestinationAddress), + data.WithdrawalAmount, + data.OriginTxId(), + ) + } + return p.bridgeContract.BridgeOut( bridgeOutTransactOpts(p.getTransactionNonce()), data.DestinationTokenAddress, common.HexToAddress(data.DestinationAddress), - data.Amount, + data.WithdrawalAmount, data.OriginTxId(), + data.IsWrappedToken, ) } diff --git a/internal/bridge/types/core.go b/internal/bridge/types/core.go new file mode 100644 index 0000000..1bd0bf7 --- /dev/null +++ b/internal/bridge/types/core.go @@ -0,0 +1,34 @@ +package types + +import ( + "github.com/ethereum/go-ethereum/common" + coretypes "github.com/hyle-team/bridgeless-core/x/bridge/types" + "github.com/pkg/errors" +) + +var ( + ErrPairNotFound = errors.New("pair not found") + ErrTokenInfoNotFound = errors.New("token info not found") +) + +type TokenPairer interface { + GetDestinationTokenInfo( + srcChainId string, + srcTokenAddr common.Address, + dstChainId string, + ) (coretypes.TokenInfo, error) +} + +type Tokener interface { + GetTokenInfo(chainId string, addr string) (coretypes.TokenInfo, error) +} + +type TxSubmitter interface { + SubmitDeposits(depositTxs ...coretypes.Transaction) error +} + +type Bridger interface { + Tokener + TokenPairer + TxSubmitter +} diff --git a/internal/bridge/types/proxy.go b/internal/bridge/types/proxy.go index 44ceb90..c26702c 100644 --- a/internal/bridge/types/proxy.go +++ b/internal/bridge/types/proxy.go @@ -54,6 +54,7 @@ type Proxy interface { AddressValid(addr string) bool TransactionHashValid(hash string) bool + WithdrawalAmountValid(amount *big.Int) bool // Ethereum-specific methods FormWithdrawalTransaction(data data.DepositData) (*types.Transaction, error) diff --git a/internal/cli/service.go b/internal/cli/service.go index 9feddb6..de4e9dc 100644 --- a/internal/cli/service.go +++ b/internal/cli/service.go @@ -2,12 +2,12 @@ package cli import ( "context" + coreconnector "github.com/hyle-team/bridgeless-signer/internal/bridge/core" "github.com/hyle-team/bridgeless-signer/internal/bridge/proxy" "sync" bridgeprocessor "github.com/hyle-team/bridgeless-signer/internal/bridge/processor" "github.com/hyle-team/bridgeless-signer/internal/config" - coreconnector "github.com/hyle-team/bridgeless-signer/internal/connectors/core" "github.com/hyle-team/bridgeless-signer/internal/core" rabbitproducer "github.com/hyle-team/bridgeless-signer/internal/core/rabbitmq/producer" "github.com/hyle-team/bridgeless-signer/internal/data/pg" @@ -33,7 +33,7 @@ func RunService(ctx context.Context, cfg config.Config) error { return errors.Wrap(err, "failed to create publisher") } - processor := bridgeprocessor.New(proxiesRepo, pg.NewDepositsQ(cfg.DB()), serviceSigner, coreConnector, coreConnector) + processor := bridgeprocessor.New(proxiesRepo, pg.NewDepositsQ(cfg.DB()), serviceSigner, coreConnector) core.RunServer(ctx, &wg, cfg, proxiesRepo, producer) core.RunConsumers(ctx, &wg, cfg, producer, processor) diff --git a/internal/config/main.go b/internal/config/main.go index c92f9ca..10d92e2 100644 --- a/internal/config/main.go +++ b/internal/config/main.go @@ -2,8 +2,8 @@ package config import ( "github.com/hyle-team/bridgeless-signer/internal/bridge/chain" + core "github.com/hyle-team/bridgeless-signer/internal/bridge/core/config" "github.com/hyle-team/bridgeless-signer/internal/bridge/signer" - core "github.com/hyle-team/bridgeless-signer/internal/connectors/core/config" api "github.com/hyle-team/bridgeless-signer/internal/core/api/config" rabbit "github.com/hyle-team/bridgeless-signer/internal/core/rabbitmq/config" "gitlab.com/distributed_lab/kit/comfig" diff --git a/internal/data/deposits.go b/internal/data/deposits.go index d861f02..110bb65 100644 --- a/internal/data/deposits.go +++ b/internal/data/deposits.go @@ -52,7 +52,7 @@ type Deposit struct { Status types.WithdrawalStatus `structs:"status" db:"status"` Depositor *string `structs:"depositor" db:"depositor"` - Amount *string `structs:"amount" db:"amount"` + DepositAmount *string `structs:"deposit_amount" db:"deposit_amount"` DepositToken *string `structs:"deposit_token" db:"deposit_token"` Receiver *string `structs:"receiver" db:"receiver"` WithdrawalToken *string `structs:"withdrawal_token" db:"withdrawal_token"` @@ -60,6 +60,9 @@ type Deposit struct { WithdrawalTxHash *string `structs:"withdrawal_tx_hash" db:"withdrawal_tx_hash"` WithdrawalChainId *string `structs:"withdrawal_chain_id" db:"withdrawal_chain_id"` + WithdrawalAmount *string `structs:"withdrawal_amount" db:"withdrawal_amount"` + + IsWrappedToken *bool `structs:"is_wrapped_token" db:"is_wrapped_token"` SubmitStatus types.SubmitWithdrawalStatus `structs:"submit_status" db:"submit_status"` } @@ -81,13 +84,15 @@ func (d Deposit) ToStatusResponse() *types.CheckWithdrawalResponse { result := &types.CheckWithdrawalResponse{ Status: d.Status, DepositData: &types.DepositData{ - EventIndex: int64(d.TxEventId), - Depositor: d.Depositor, - Amount: d.Amount, - DepositToken: d.DepositToken, - WithdrawalToken: d.WithdrawalToken, - Receiver: d.Receiver, - BlockNumber: d.DepositBlock, + EventIndex: int64(d.TxEventId), + Depositor: d.Depositor, + DepositAmount: d.DepositAmount, + WithdrawalAmount: d.WithdrawalAmount, + DepositToken: d.DepositToken, + WithdrawalToken: d.WithdrawalToken, + Receiver: d.Receiver, + BlockNumber: d.DepositBlock, + IsWrapped: d.IsWrappedToken, }, DepositTransaction: &types.Transaction{ Hash: d.TxHash, @@ -108,12 +113,13 @@ func (d Deposit) ToStatusResponse() *types.CheckWithdrawalResponse { func (d Deposit) ToTransaction() bridgetypes.Transaction { tx := bridgetypes.Transaction{ - DepositTxHash: d.TxHash, - DepositTxIndex: uint64(d.TxEventId), - DepositChainId: d.ChainId, - WithdrawalTxHash: stringOrEmpty(d.WithdrawalTxHash), - Depositor: stringOrEmpty(d.Depositor), - Amount: stringOrEmpty(d.Amount), + DepositTxHash: d.TxHash, + DepositTxIndex: uint64(d.TxEventId), + DepositChainId: d.ChainId, + WithdrawalTxHash: stringOrEmpty(d.WithdrawalTxHash), + Depositor: stringOrEmpty(d.Depositor), + // TODO: separate for deposit/withdrawal amount when added to bridge core + Amount: stringOrEmpty(d.WithdrawalAmount), DepositToken: stringOrEmpty(d.DepositToken), Receiver: stringOrEmpty(d.Receiver), WithdrawalToken: stringOrEmpty(d.WithdrawalToken), @@ -134,11 +140,14 @@ type DepositData struct { SourceAddress string DestinationAddress string - Amount *big.Int + DepositAmount *big.Int + WithdrawalAmount *big.Int TokenAddress common.Address DestinationTokenAddress common.Address + IsWrappedToken bool + Block int64 } diff --git a/internal/data/pg/deposits.go b/internal/data/pg/deposits.go index 0726ab0..f4174ef 100644 --- a/internal/data/pg/deposits.go +++ b/internal/data/pg/deposits.go @@ -2,7 +2,6 @@ package pg import ( "database/sql" - "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" "strings" @@ -21,17 +20,20 @@ const ( depositsStatus = "status" depositsId = "id" - depositsDepositor = "depositor" - depositsAmount = "amount" - depositsDepositToken = "deposit_token" - depositsReceiver = "receiver" - depositsWithdrawalToken = "withdrawal_token" - depositsDepositBlock = "deposit_block" + depositsDepositor = "depositor" + depositsDepositAmount = "deposit_amount" + depositsWithdrawalAmount = "withdrawal_amount" + depositsDepositToken = "deposit_token" + depositsReceiver = "receiver" + depositsWithdrawalToken = "withdrawal_token" + depositsDepositBlock = "deposit_block" depositsWithdrawalTxHash = "withdrawal_tx_hash" depositsWithdrawalChainId = "withdrawal_chain_id" depositsSubmitStatus = "submit_status" + + depositIsWrappedToken = "is_wrapped_token" ) type depositsQ struct { @@ -142,22 +144,25 @@ func (d *depositsQ) UpdateSubmitStatus(status types.SubmitWithdrawalStatus, ids func (d *depositsQ) SetDepositData(data data.DepositData) error { fields := map[string]interface{}{ - depositsAmount: data.Amount.String(), - depositsReceiver: strings.ToLower(data.DestinationAddress), - depositsDepositBlock: data.Block, - } - - if data.TokenAddress != (common.Address{}) { - fields[depositsDepositToken] = strings.ToLower(data.TokenAddress.String()) - } - if data.SourceAddress != "" { - fields[depositsDepositor] = strings.ToLower(data.SourceAddress) - } - if data.DestinationTokenAddress != (common.Address{}) { - fields[depositsWithdrawalToken] = strings.ToLower(data.DestinationTokenAddress.String()) + depositsDepositAmount: data.DepositAmount.String(), + depositsWithdrawalAmount: data.WithdrawalAmount.String(), + depositsReceiver: strings.ToLower(data.DestinationAddress), + depositsDepositBlock: data.Block, + depositIsWrappedToken: data.IsWrappedToken, + // can be 0x00... in case of native ones + depositsDepositToken: strings.ToLower(data.TokenAddress.String()), + depositsDepositor: strings.ToLower(data.SourceAddress), + // can be 0x00... in case of native ones + depositsWithdrawalToken: strings.ToLower(data.DestinationTokenAddress.String()), } - return d.db.Exec(squirrel.Update(depositsTable).SetMap(fields)) + return d.db.Exec(squirrel.Update(depositsTable).Where( + squirrel.Eq{ + depositsTxHash: data.TxHash, + depositsTxEventId: data.TxEventId, + depositsChainId: data.ChainId, + }, + ).SetMap(fields)) } func NewDepositsQ(db *pgdb.DB) data.DepositsQ { diff --git a/pkg/tokens/types.go b/pkg/tokens/types.go deleted file mode 100644 index 04507bc..0000000 --- a/pkg/tokens/types.go +++ /dev/null @@ -1,24 +0,0 @@ -package tokens - -import ( - "github.com/ethereum/go-ethereum/common" - "github.com/pkg/errors" -) - -var ( - ErrPairNotFound = errors.New("pair not found") - ErrSourceTokenNotSupported = errors.New("source token not supported") - ErrDestinationTokenNotSupported = errors.New("destination token not supported") -) - -type TokenPairerConfiger interface { - TokenPairer() TokenPairer -} - -type TokenPairer interface { - GetDestinationTokenAddress( - srcChainId string, - srcTokenAddr common.Address, - dstChainId string, - ) (common.Address, error) -} diff --git a/pkg/types/service.pb.go b/pkg/types/service.pb.go index e114420..bec9567 100644 --- a/pkg/types/service.pb.go +++ b/pkg/types/service.pb.go @@ -231,13 +231,15 @@ type DepositData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - EventIndex int64 `protobuf:"varint,2,opt,name=event_index,json=eventIndex,proto3" json:"event_index,omitempty"` - BlockNumber *int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3,oneof" json:"block_number,omitempty"` - Depositor *string `protobuf:"bytes,4,opt,name=depositor,proto3,oneof" json:"depositor,omitempty"` - Amount *string `protobuf:"bytes,5,opt,name=amount,proto3,oneof" json:"amount,omitempty"` - DepositToken *string `protobuf:"bytes,6,opt,name=deposit_token,json=depositToken,proto3,oneof" json:"deposit_token,omitempty"` - Receiver *string `protobuf:"bytes,7,opt,name=receiver,proto3,oneof" json:"receiver,omitempty"` - WithdrawalToken *string `protobuf:"bytes,8,opt,name=withdrawal_token,json=withdrawalToken,proto3,oneof" json:"withdrawal_token,omitempty"` + EventIndex int64 `protobuf:"varint,2,opt,name=event_index,json=eventIndex,proto3" json:"event_index,omitempty"` + BlockNumber *int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3,oneof" json:"block_number,omitempty"` + Depositor *string `protobuf:"bytes,4,opt,name=depositor,proto3,oneof" json:"depositor,omitempty"` + DepositAmount *string `protobuf:"bytes,5,opt,name=deposit_amount,json=depositAmount,proto3,oneof" json:"deposit_amount,omitempty"` + DepositToken *string `protobuf:"bytes,6,opt,name=deposit_token,json=depositToken,proto3,oneof" json:"deposit_token,omitempty"` + Receiver *string `protobuf:"bytes,7,opt,name=receiver,proto3,oneof" json:"receiver,omitempty"` + WithdrawalToken *string `protobuf:"bytes,8,opt,name=withdrawal_token,json=withdrawalToken,proto3,oneof" json:"withdrawal_token,omitempty"` + IsWrapped *bool `protobuf:"varint,9,opt,name=is_wrapped,json=isWrapped,proto3,oneof" json:"is_wrapped,omitempty"` + WithdrawalAmount *string `protobuf:"bytes,10,opt,name=withdrawal_amount,json=withdrawalAmount,proto3,oneof" json:"withdrawal_amount,omitempty"` } func (x *DepositData) Reset() { @@ -293,9 +295,9 @@ func (x *DepositData) GetDepositor() string { return "" } -func (x *DepositData) GetAmount() string { - if x != nil && x.Amount != nil { - return *x.Amount +func (x *DepositData) GetDepositAmount() string { + if x != nil && x.DepositAmount != nil { + return *x.DepositAmount } return "" } @@ -321,6 +323,20 @@ func (x *DepositData) GetWithdrawalToken() string { return "" } +func (x *DepositData) GetIsWrapped() bool { + if x != nil && x.IsWrapped != nil { + return *x.IsWrapped + } + return false +} + +func (x *DepositData) GetWithdrawalAmount() string { + if x != nil && x.WithdrawalAmount != nil { + return *x.WithdrawalAmount + } + return "" +} + type CheckWithdrawalResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -454,7 +470,7 @@ var file_service_proto_rawDesc = []byte{ 0x0a, 0x16, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x54, 0x78, 0x49, 0x64, 0x22, 0xef, 0x02, 0x0a, 0x0b, 0x44, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x54, 0x78, 0x49, 0x64, 0x22, 0x81, 0x04, 0x0a, 0x0b, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x26, 0x0a, 0x0c, 0x62, @@ -462,73 +478,82 @@ var file_service_proto_rawDesc = []byte{ 0x03, 0x48, 0x00, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x09, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x0c, 0x64, 0x65, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, - 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x04, 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2e, - 0x0a, 0x10, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x05, 0x52, 0x0f, 0x77, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x0f, - 0x0a, 0x0d, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, - 0x0c, 0x0a, 0x0a, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x64, 0x65, 0x70, - 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x77, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xe3, 0x02, 0x0a, - 0x17, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x57, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x43, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x74, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0c, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x12, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, - 0x2e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x44, 0x61, 0x74, 0x61, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x0b, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x48, 0x0a, 0x16, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0c, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, - 0x15, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x0d, 0x73, 0x75, 0x62, - 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x17, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, - 0x77, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0c, 0x73, 0x75, 0x62, 0x6d, 0x69, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x19, 0x0a, 0x17, 0x5f, 0x77, 0x69, 0x74, 0x68, - 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x2a, 0x7f, 0x0a, 0x10, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x0e, 0x0a, 0x0a, 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, - 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, - 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x58, 0x5f, 0x50, - 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x58, 0x5f, 0x46, - 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x58, 0x5f, 0x53, 0x55, - 0x43, 0x43, 0x45, 0x53, 0x53, 0x46, 0x55, 0x4c, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, - 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x2a, 0x4e, 0x0a, 0x16, - 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x55, - 0x42, 0x4d, 0x49, 0x54, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x55, 0x42, - 0x4d, 0x49, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, - 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x46, 0x55, 0x4c, 0x10, 0x02, 0x32, 0xb2, 0x01, 0x0a, - 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x6d, - 0x69, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x12, 0x12, 0x2e, 0x57, - 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, - 0x3a, 0x01, 0x2a, 0x22, 0x07, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x12, 0x63, 0x0a, 0x0f, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x12, - 0x17, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, - 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x2f, 0x7b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x64, - 0x7d, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x68, 0x79, 0x6c, 0x65, 0x2d, 0x74, 0x65, 0x61, 0x6d, 0x2f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, - 0x6c, 0x65, 0x73, 0x73, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x0e, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, + 0x52, 0x0d, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x0c, 0x64, 0x65, 0x70, + 0x6f, 0x73, 0x69, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, + 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x04, + 0x52, 0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2e, 0x0a, + 0x10, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x05, 0x52, 0x0f, 0x77, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x61, 0x6c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, + 0x0a, 0x69, 0x73, 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x08, 0x48, 0x06, 0x52, 0x09, 0x69, 0x73, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x88, 0x01, + 0x01, 0x12, 0x30, 0x0a, 0x11, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x48, 0x07, 0x52, 0x10, + 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x72, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x72, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, + 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x69, 0x73, + 0x5f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x64, 0x42, 0x14, 0x0a, 0x12, 0x5f, 0x77, 0x69, 0x74, + 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe3, + 0x02, 0x0a, 0x17, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, + 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x57, 0x69, 0x74, + 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x43, 0x0a, 0x13, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x12, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0c, 0x64, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x44, 0x61, 0x74, 0x61, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x44, 0x61, 0x74, + 0x61, 0x12, 0x48, 0x0a, 0x16, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x00, 0x52, 0x15, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x0d, 0x73, + 0x75, 0x62, 0x6d, 0x69, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0c, 0x73, 0x75, 0x62, + 0x6d, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x19, 0x0a, 0x17, 0x5f, 0x77, 0x69, + 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x2a, 0x7f, 0x0a, + 0x10, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x58, + 0x5f, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x58, + 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x58, 0x5f, + 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x46, 0x55, 0x4c, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, + 0x52, 0x45, 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x2a, 0x4e, + 0x0a, 0x16, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, + 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x4f, 0x54, 0x5f, + 0x53, 0x55, 0x42, 0x4d, 0x49, 0x54, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x53, + 0x55, 0x42, 0x4d, 0x49, 0x54, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0e, + 0x0a, 0x0a, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x46, 0x55, 0x4c, 0x10, 0x02, 0x32, 0xb2, + 0x01, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x42, 0x0a, 0x10, 0x53, 0x75, + 0x62, 0x6d, 0x69, 0x74, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x12, 0x12, + 0x2e, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x0c, 0x3a, 0x01, 0x2a, 0x22, 0x07, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x12, 0x63, + 0x0a, 0x0f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, + 0x6c, 0x12, 0x17, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, + 0x77, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x2f, 0x7b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x74, 0x78, 0x5f, + 0x69, 0x64, 0x7d, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x68, 0x79, 0x6c, 0x65, 0x2d, 0x74, 0x65, 0x61, 0x6d, 0x2f, 0x62, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x2f, 0x70, 0x6b, + 0x67, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/buf.lock b/proto/buf.lock index 724d83a..3498d4b 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -9,8 +9,8 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 8bc2c51e08c447cd8886cdea48a73e14 - digest: shake256:a969155953a5cedc5b2df5b42c368f2bc66ff8ce1804bc96e0f14ff2ee8a893687963058909df844d1643cdbc98ff099d2daa6bc9f9f5b8886c49afdc60e19af + commit: e7f8d366f5264595bcc4cd4139af9973 + digest: shake256:e5e5f1c12f82e028ea696faa43b4f9dc6258a6d1226282962a8c8b282e10946281d815884f574bd279ebd9cd7588629beb3db17b892af6c33b56f92f8f67f509 - remote: buf.build owner: grpc-ecosystem repository: grpc-gateway diff --git a/proto/service.proto b/proto/service.proto index cbe3e0d..cfe4f00 100644 --- a/proto/service.proto +++ b/proto/service.proto @@ -34,10 +34,12 @@ message DepositData { int64 event_index = 2; optional int64 block_number = 3; optional string depositor = 4; - optional string amount = 5; + optional string deposit_amount = 5; optional string deposit_token = 6; optional string receiver = 7; optional string withdrawal_token = 8; + optional bool is_wrapped = 9; + optional string withdrawal_amount = 10; } message CheckWithdrawalResponse {