Documentation ¶
Index ¶
- Constants
- func AddToken2LockList(symbol, token string, client ethinterface.EthClientSpec, para *OperatorInfo, ...) (string, error)
- func ApproveAllowance(ownerPrivateKeyStr, tokenAddr string, bridgeBank common.Address, ...) (string, error)
- func Burn(ownerPrivateKeyStr, tokenAddrstr, chain33Receiver string, ...) (string, error)
- func BurnAsync(ownerPrivateKeyStr, tokenAddrstr, chain33Receiver string, amount *big.Int, ...) (string, error)
- func ConfigLockedTokenOfflineSave(addr, symbol string, threshold *big.Int, percents uint8, ...) (string, error)
- func ConfigOfflineSaveAccount(addr string, client ethinterface.EthClientSpec, para *OperatorInfo, ...) (string, error)
- func CreateBridgeToken(symbol string, client ethinterface.EthClientSpec, para *OperatorInfo, ...) (string, error)
- func DeployAndInit(client ethinterface.EthClientSpec, para *DeployPara) (*X2EthContracts, *X2EthDeployInfo, error)
- func DeployERC20(ownerAddr, name, symbol string, amount *big.Int, ...) (string, error)
- func DeployMulSign2Eth(client ethinterface.EthClientSpec, para *OperatorInfo) (string, error)
- func GetAddressFromBridgeRegistry(client ethinterface.EthClientSpec, sender, registry common.Address, ...) (address *common.Address, err error)
- func GetBalance(client ethinterface.EthClientSpec, tokenAddr, owner string) (string, error)
- func GetDeployHeight(client ethinterface.EthClientSpec, sender, registry common.Address) (height int64, err error)
- func GetDepositFunds(client bind.ContractBackend, tokenAddrStr string) (string, error)
- func GetEthTxStatus(client ethinterface.EthClientSpec, txhash common.Hash) string
- func GetLockedFunds(bridgeBank *generated.BridgeBank, tokenAddrStr string) (string, error)
- func GetLockedTokenAddress(bridgeBank *generated.BridgeBank, tokenSymbol string) (string, error)
- func GetOperator(client ethinterface.EthClientSpec, sender, bridgeBank common.Address) (common.Address, error)
- func GetToken2address(bridgeBank *generated.BridgeBank, tokenSymbol string) (string, error)
- func IsActiveValidator(validator common.Address, valset *generated.Valset) (bool, error)
- func IsProphecyPending(claimID [32]byte, validator common.Address, ...) (bool, error)
- func LoadABI(contractName string) abi.ABI
- func LockEthErc20Asset(ownerPrivateKeyStr, tokenAddrStr, chain33Receiver string, amount *big.Int, ...) (string, error)
- func LockEthErc20AssetAsync(ownerPrivateKeyStr, tokenAddrStr, chain33Receiver string, amount *big.Int, ...) (string, error)
- func LogBurnToEthBridgeClaim(event *events.BurnEvent, ethereumChainID int64, ...) (*ebrelayerTypes.EthBridgeClaim, error)
- func LogLockToEthBridgeClaim(event *events.LockEvent, ethereumChainID int64, ...) (*ebrelayerTypes.EthBridgeClaim, error)
- func PrepareAuth(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, ...) (*bind.TransactOpts, error)
- func PrepareAuthHsm(client ethinterface.EthClientSpec, keyIndex int, transactor common.Address) (*bind.TransactOpts, error)
- func RecoverContractHandler(client ethinterface.EthClientSpec, sender, registry common.Address) (*X2EthContracts, *X2EthDeployInfo, error)
- func RecoverOracleInstance(client ethinterface.EthClientSpec, sender, registry common.Address) (*generated.Oracle, error)
- func RelayOracleClaimToEthereum(oracleInstance *generated.Oracle, client ethinterface.EthClientSpec, ...) (txhash string, err error)
- func SafeTransfer(ownerPrivateKeyStr, multiSignAddrstr, receiver, token string, ...) (string, error)
- func SetupMultiSign(ownerPrivateKeyStr, multiSignAddrstr string, owners []string, ...) (string, error)
- func SetupWebsocketEthClient(ethURL string) (*ethclient.Client, error)
- func TransferEth(fromPrivateKeyStr, toAddr string, amount *big.Int, ...) (string, error)
- func TransferToken(tokenAddr, fromPrivateKeyStr, toAddr string, amount *big.Int, ...) (string, error)
- type ContractRegistry
- type DeployPara
- type DeployResult
- func DeployBridgeBank(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, ...) (*generated.BridgeBank, *DeployResult, error)
- func DeployBridgeRegistry(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, ...) (*generated.BridgeRegistry, *DeployResult, error)
- func DeployChain33Bridge(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, ...) (*generated.Chain33Bridge, *DeployResult, error)
- func DeployOracle(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, ...) (*generated.Oracle, *DeployResult, error)
- func DeployValset(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, ...) (*generated.Valset, *DeployResult, error)
- type EthTxStatus
- type NewProphecyClaimPara
- type OperatorInfo
- type OracleClaim
- type ProphecyClaim
- type X2EthContracts
- type X2EthDeployInfo
Constants ¶
const ( BridgeBankABI = "BridgeBankABI" Chain33BankABI = "Chain33BankABI" Chain33BridgeABI = "Chain33BridgeABI" EthereumBankABI = "EthereumBankABI" )
const
const ( // GasLimit : the gas limit in Gwei used for transactions sent with TransactOpts GasLimit = uint64(100 * 10000) GasLimit4Deploy = uint64(0) //此处需要设置为0,让交易自行估计,否则将会导致部署失败,TODO:其他解决途径后续调研解决 )
const ...
const ( X2Eth = "x2ethereum" BurnAction = "Chain33ToEthBurn" LockAction = "Chain33ToEthLock" )
const ...
const ( PendingDuration4TxExeuction = 300 EthTxPending = EthTxStatus(2) )
const
Variables ¶
This section is empty.
Functions ¶
func AddToken2LockList ¶
func AddToken2LockList(symbol, token string, client ethinterface.EthClientSpec, para *OperatorInfo, x2EthContracts *X2EthContracts) (string, error)
func ApproveAllowance ¶
func ApproveAllowance(ownerPrivateKeyStr, tokenAddr string, bridgeBank common.Address, amount *big.Int, client ethinterface.EthClientSpec) (string, error)
ApproveAllowance ...
func Burn ¶
func Burn(ownerPrivateKeyStr, tokenAddrstr, chain33Receiver string, bridgeBank common.Address, amount *big.Int, bridgeBankIns *generated.BridgeBank, client ethinterface.EthClientSpec) (string, error)
Burn ...
func BurnAsync ¶
func BurnAsync(ownerPrivateKeyStr, tokenAddrstr, chain33Receiver string, amount *big.Int, bridgeBankIns *generated.BridgeBank, client ethinterface.EthClientSpec) (string, error)
BurnAsync ...
func ConfigLockedTokenOfflineSave ¶
func ConfigLockedTokenOfflineSave(addr, symbol string, threshold *big.Int, percents uint8, client ethinterface.EthClientSpec, para *OperatorInfo, x2EthContracts *X2EthContracts) (string, error)
func ConfigOfflineSaveAccount ¶
func ConfigOfflineSaveAccount(addr string, client ethinterface.EthClientSpec, para *OperatorInfo, x2EthContracts *X2EthContracts) (string, error)
func CreateBridgeToken ¶
func CreateBridgeToken(symbol string, client ethinterface.EthClientSpec, para *OperatorInfo, x2EthDeployInfo *X2EthDeployInfo, x2EthContracts *X2EthContracts) (string, error)
CreateBridgeToken ...
func DeployAndInit ¶
func DeployAndInit(client ethinterface.EthClientSpec, para *DeployPara) (*X2EthContracts, *X2EthDeployInfo, error)
DeployAndInit ...
func DeployERC20 ¶
func DeployERC20(ownerAddr, name, symbol string, amount *big.Int, client ethinterface.EthClientSpec, para *OperatorInfo) (string, error)
func DeployMulSign2Eth ¶
func DeployMulSign2Eth(client ethinterface.EthClientSpec, para *OperatorInfo) (string, error)
func GetAddressFromBridgeRegistry ¶
func GetAddressFromBridgeRegistry(client ethinterface.EthClientSpec, sender, registry common.Address, target ContractRegistry) (address *common.Address, err error)
GetAddressFromBridgeRegistry : utility method which queries the requested contract address from the BridgeRegistry
func GetBalance ¶
func GetBalance(client ethinterface.EthClientSpec, tokenAddr, owner string) (string, error)
GetBalance ...
func GetDeployHeight ¶
func GetDeployHeight(client ethinterface.EthClientSpec, sender, registry common.Address) (height int64, err error)
GetDeployHeight : 获取合约部署高度
func GetDepositFunds ¶
func GetDepositFunds(client bind.ContractBackend, tokenAddrStr string) (string, error)
GetDepositFunds ...
func GetEthTxStatus ¶
func GetEthTxStatus(client ethinterface.EthClientSpec, txhash common.Hash) string
GetEthTxStatus ...
func GetLockedFunds ¶
func GetLockedFunds(bridgeBank *generated.BridgeBank, tokenAddrStr string) (string, error)
GetLockedFunds ...
func GetLockedTokenAddress ¶
func GetLockedTokenAddress(bridgeBank *generated.BridgeBank, tokenSymbol string) (string, error)
GetLockedTokenAddress ...
func GetOperator ¶
func GetOperator(client ethinterface.EthClientSpec, sender, bridgeBank common.Address) (common.Address, error)
GetOperator ...
func GetToken2address ¶
func GetToken2address(bridgeBank *generated.BridgeBank, tokenSymbol string) (string, error)
GetToken2address ...
func IsActiveValidator ¶
IsActiveValidator ...
func IsProphecyPending ¶
func IsProphecyPending(claimID [32]byte, validator common.Address, chain33Bridge *generated.Chain33Bridge) (bool, error)
IsProphecyPending ...
func LockEthErc20Asset ¶
func LockEthErc20Asset(ownerPrivateKeyStr, tokenAddrStr, chain33Receiver string, amount *big.Int, client ethinterface.EthClientSpec, bridgeBank *generated.BridgeBank, bridgeBankAddr common.Address) (string, error)
LockEthErc20Asset ...
func LockEthErc20AssetAsync ¶
func LockEthErc20AssetAsync(ownerPrivateKeyStr, tokenAddrStr, chain33Receiver string, amount *big.Int, client ethinterface.EthClientSpec, bridgeBank *generated.BridgeBank) (string, error)
LockEthErc20AssetAsync ...
func LogBurnToEthBridgeClaim ¶
func LogBurnToEthBridgeClaim(event *events.BurnEvent, ethereumChainID int64, bridgeBrankAddr, ethTxHash string, decimal int64) (*ebrelayerTypes.EthBridgeClaim, error)
LogBurnToEthBridgeClaim ...
func LogLockToEthBridgeClaim ¶
func LogLockToEthBridgeClaim(event *events.LockEvent, ethereumChainID int64, bridgeBrankAddr, ethTxHash string, decimal int64) (*ebrelayerTypes.EthBridgeClaim, error)
LogLockToEthBridgeClaim : parses and packages a LockEvent struct with a validator address in an EthBridgeClaim msg
func PrepareAuth ¶
func PrepareAuth(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, transactor common.Address) (*bind.TransactOpts, error)
PrepareAuth ...
func PrepareAuthHsm ¶
func PrepareAuthHsm(client ethinterface.EthClientSpec, keyIndex int, transactor common.Address) (*bind.TransactOpts, error)
func RecoverContractHandler ¶
func RecoverContractHandler(client ethinterface.EthClientSpec, sender, registry common.Address) (*X2EthContracts, *X2EthDeployInfo, error)
RecoverContractHandler ...
func RecoverOracleInstance ¶
func RecoverOracleInstance(client ethinterface.EthClientSpec, sender, registry common.Address) (*generated.Oracle, error)
RecoverOracleInstance ...
func RelayOracleClaimToEthereum ¶
func RelayOracleClaimToEthereum(oracleInstance *generated.Oracle, client ethinterface.EthClientSpec, sender, tokenOnEth common.Address, claim ProphecyClaim, privateKey *ecdsa.PrivateKey, signViaHsm bool, secp256k1Index int) (txhash string, err error)
RelayOracleClaimToEthereum : relays the provided burn or lock to Chain33Bridge contract on the Ethereum network
func SafeTransfer ¶
func SafeTransfer(ownerPrivateKeyStr, multiSignAddrstr, receiver, token string, privateKeys []string, amount float64, client ethinterface.EthClientSpec) (string, error)
func SetupMultiSign ¶
func SetupMultiSign(ownerPrivateKeyStr, multiSignAddrstr string, owners []string, client ethinterface.EthClientSpec) (string, error)
func SetupWebsocketEthClient ¶
SetupWebsocketEthClient : returns boolean indicating if a URL is valid websocket ethclient
func TransferEth ¶
func TransferEth(fromPrivateKeyStr, toAddr string, amount *big.Int, client ethinterface.EthClientSpec) (string, error)
func TransferToken ¶
func TransferToken(tokenAddr, fromPrivateKeyStr, toAddr string, amount *big.Int, client ethinterface.EthClientSpec) (string, error)
TransferToken ...
Types ¶
type ContractRegistry ¶
type ContractRegistry byte
ContractRegistry :
const ( // Valset : valset contract Valset ContractRegistry = iota + 1 // Oracle : oracle contract Oracle // BridgeBank : bridgeBank contract BridgeBank // Chain33Bridge : chain33Bridge contract Chain33Bridge )
func (ContractRegistry) String ¶
func (d ContractRegistry) String() string
String : returns the event type as a string
type DeployPara ¶
type DeployPara struct { DeployPrivateKey *ecdsa.PrivateKey Deployer common.Address Operator common.Address InitValidators []common.Address ValidatorPriKey []*ecdsa.PrivateKey InitPowers []*big.Int }
DeployPara ...
type DeployResult ¶
DeployResult ...
func DeployBridgeBank ¶
func DeployBridgeBank(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, deployer, operator, oracle, chain33Bridge common.Address) (*generated.BridgeBank, *DeployResult, error)
DeployBridgeBank : 部署BridgeBank
func DeployBridgeRegistry ¶
func DeployBridgeRegistry(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, deployer, chain33BridgeAddr, bridgeBankAddr, oracleAddr, valsetAddr common.Address) (*generated.BridgeRegistry, *DeployResult, error)
DeployBridgeRegistry : 部署BridgeRegistry
func DeployChain33Bridge ¶
func DeployChain33Bridge(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, deployer common.Address, operator, valset common.Address) (*generated.Chain33Bridge, *DeployResult, error)
DeployChain33Bridge : 部署Chain33Bridge
func DeployOracle ¶
func DeployOracle(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, deployer, operator, valset, chain33Bridge common.Address) (*generated.Oracle, *DeployResult, error)
DeployOracle : 部署Oracle
func DeployValset ¶
func DeployValset(client ethinterface.EthClientSpec, privateKey *ecdsa.PrivateKey, deployer common.Address, operator common.Address, initValidators []common.Address, initPowers []*big.Int) (*generated.Valset, *DeployResult, error)
DeployValset : 部署Valset
type NewProphecyClaimPara ¶
type NewProphecyClaimPara struct { ClaimType uint8 Chain33Sender []byte TokenAddr common.Address EthReceiver common.Address Symbol string Amount *big.Int Txhash []byte }
NewProphecyClaimPara ...
type OperatorInfo ¶
type OperatorInfo struct { PrivateKey *ecdsa.PrivateKey Address common.Address }
OperatorInfo ...
type OracleClaim ¶
OracleClaim : contains data required to make an OracleClaim
type ProphecyClaim ¶
type ProphecyClaim struct { ClaimType events.ClaimType Chain33Sender []byte EthereumReceiver common.Address TokenContractAddress common.Address Symbol string Amount *big.Int // contains filtered or unexported fields }
ProphecyClaim : contains data required to make an ProphecyClaim
func Chain33MsgToProphecyClaim ¶
func Chain33MsgToProphecyClaim(msg events.Chain33Msg) ProphecyClaim
Chain33MsgToProphecyClaim : parses event data from a Chain33Msg, packaging it as a ProphecyClaim
type X2EthContracts ¶
type X2EthContracts struct { BridgeRegistry *generated.BridgeRegistry BridgeBank *generated.BridgeBank Chain33Bridge *generated.Chain33Bridge Valset *generated.Valset Oracle *generated.Oracle }
X2EthContracts ...
type X2EthDeployInfo ¶
type X2EthDeployInfo struct { BridgeRegistry *DeployResult BridgeBank *DeployResult Chain33Bridge *DeployResult Valset *DeployResult Oracle *DeployResult }
X2EthDeployResult ...