Documentation ¶
Index ¶
- Constants
- Variables
- func AdminAddAdmin(client *client.Client, bridge common.Address, newAdmin common.Address) error
- func AdminAddRelyaer(client *client.Client, bridge common.Address, relayer common.Address) error
- func AdminFeeAmount(client *client.Client, bridge common.Address) (*big.Int, error)
- func AdminIsRelayer(client *client.Client, bridge common.Address, relayer common.Address) (bool, error)
- func AdminPause(client *client.Client, bridge common.Address) error
- func AdminRemoveAdmin(client *client.Client, bridge common.Address, addresToRevoke common.Address) error
- func AdminRemoveRelayer(client *client.Client, bridge common.Address, relayer common.Address) error
- func AdminSetFee(client *client.Client, bridge common.Address, newFee *big.Int) error
- func AdminSetThreshHold(client *client.Client, bridge common.Address, treshHold *big.Int) error
- func AdminUnpause(client *client.Client, bridge common.Address) error
- func AdminWithdraw(client *client.Client, bridge, handler, token, recipient common.Address, ...) error
- func BridgeDeposit(client *client.Client, bridge common.Address, destChainID uint8, ...) error
- func BuildQuery(contract common.Address, sig EventSig, startBlock *big.Int, endBlock *big.Int) ethereum.FilterQuery
- func CancelProposal(client *client.Client, bridgeAddress common.Address, chainID uint8, ...) error
- func ConstructErc20DepositData(destRecipient []byte, amount *big.Int) []byte
- func ConstructErc721DepositData(tokenId *big.Int, destRecipient []byte) []byte
- func ConstructGenericDepositData(metadata []byte) []byte
- func DeployBridge(client *client.Client, chainID uint8, relayerAddrs []common.Address, ...) (common.Address, error)
- func DeployERC20Handler(client *client.Client, bridgeAddress common.Address) (common.Address, error)
- func DeployERC20Token(client *client.Client, name, symbol string) (common.Address, error)
- func DeployERC721Handler(client *client.Client, bridgeAddress common.Address) (common.Address, error)
- func DeployERC721Token(client *client.Client) (common.Address, error)
- func DeployGenericHandler(client *client.Client, bridgeAddress common.Address) (common.Address, error)
- func ERC20AddMinter(client *client.Client, erc20Address, minter common.Address) error
- func ERC20Allowance(client *client.Client, erc20Address, spender, owner common.Address) (*big.Int, error)
- func ERC20Approve(client *client.Client, erc20Address, spender common.Address, amount *big.Int) error
- func ERC20BalanceOf(client *client.Client, erc20Address, dest common.Address) (*big.Int, error)
- func ERC20IsMinter(client *client.Client, erc20Address, minter common.Address) (bool, error)
- func ERC20Mint(client *client.Client, amount *big.Int, erc20Address, recipient common.Address) error
- func ERC20MinterRole(client *client.Client, erc20Address common.Address) ([32]byte, error)
- func ERC20Transfer(client *client.Client, erc20 *erc20.ERC20PresetMinterPauser, ...) (*types.Transaction, error)
- func ERC721AddMinter(client *client.Client, erc721Address, minter common.Address) error
- func ERC721Approve(client *client.Client, erc721Address, recipient common.Address, id *big.Int) error
- func ERC721Mint(client *client.Client, erc721Address, to common.Address, id *big.Int, ...) error
- func ERC721MinterRole(client *client.Client, erc721Address common.Address) ([32]byte, error)
- func ERC721OwnerOf(client *client.Client, erc721Address common.Address, id *big.Int) (common.Address, error)
- func Erc20AddMinter(client *client.Client, erc20Contract, handler common.Address) error
- func Erc20Approve(client *client.Client, erc20Contract, target common.Address, amount *big.Int) error
- func GetSolidityFunctionSig(in string) [4]byte
- func IsActive(status uint8) bool
- func IsExecuted(status uint8) bool
- func IsPassed(status uint8) bool
- func MakeAndSendERC20Deposit(client *client.Client, bridgeAddress common.Address, recipient common.Address, ...) error
- func MakeAndSendERC721Deposit(client *client.Client, bridgeAddress common.Address, recipient common.Address, ...) error
- func MakeErc20Deposit(client *client.Client, bridgeAddress common.Address, recipient common.Address, ...) (*types.Transaction, error)
- func MintTokens(client *client.Client, erc20Addr common.Address, amount *big.Int) error
- func QueryProposal(client *client.Client, bridgeAddress common.Address, chainID uint8, ...) (*Bridge.BridgeProposal, error)
- func QueryResource(client *client.Client, handler common.Address, resourceID [32]byte) (common.Address, error)
- func RegisterGenericResource(client *client.Client, bridge, handler common.Address, rId msg.ResourceId, ...) error
- func RegisterResource(client *client.Client, bridge, handler common.Address, rId [32]byte, ...) error
- func RlpEncodeHeader(header *types.Header) ([]byte, error)
- func SetBurnable(client *client.Client, bridge, handler, contract common.Address) error
- func Simulate(client *client.Client, block *big.Int, txHash common.Hash, from common.Address) ([]byte, error)
- func SliceTo32Bytes(in []byte) [32]byte
- func SliceTo4Bytes(in []byte) [4]byte
- func UserAmountToWei(amount string, decimal *big.Int) (*big.Int, error)
- func WaitAndReturnTxReceipt(client *client.Client, tx *types.Transaction) (*types.Receipt, error)
- func WaitForTx(client *client.Client, tx *types.Transaction) error
- func WeiAmountToUser(amount *big.Int, decimals *big.Int) (*big.Float, error)
- type ChainId
- type DeployedContracts
- type EventSig
- type MerkleProof
- type Message
- func NewFungibleTransfer(source, dest ChainId, nonce Nonce, resourceId ResourceId, mp *MerkleProof, ...) *Message
- func NewGenericTransfer(source, dest ChainId, nonce Nonce, resourceId ResourceId, mp *MerkleProof, ...) *Message
- func NewNonFungibleTransfer(source, dest ChainId, nonce Nonce, resourceId ResourceId, mp *MerkleProof, ...) *Message
- type Nonce
- type ProposalStatus
- type ResourceId
- type SignatureVerification
- type TransferType
Constants ¶
const DefaultGasLimit = 6721975
const DefaultGasPrice = 20000000000
Variables ¶
var AdminRole = "0000000000000000000000000000000000000000000000000000000000000000"
var AliceKp = keystore.TestKeyRing.EthereumKeys[keystore.AliceKey]
var BobKp = keystore.TestKeyRing.EthereumKeys[keystore.BobKey]
var ( DefaultRelayerAddresses = []common.Address{ common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.AliceKey].Address()), common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.BobKey].Address()), common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.CharlieKey].Address()), common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.DaveKey].Address()), common.HexToAddress(keystore.TestKeyRing.EthereumKeys[keystore.EveKey].Address()), } )
var EveKp = keystore.TestKeyRing.EthereumKeys[keystore.EveKey]
var ExpectedBlockTime = 2 * time.Second
Functions ¶
func AdminAddAdmin ¶
func AdminAddRelyaer ¶
func AdminFeeAmount ¶
func AdminIsRelayer ¶
func AdminRemoveAdmin ¶
func AdminRemoveRelayer ¶
func AdminSetFee ¶
func AdminSetThreshHold ¶
func AdminWithdraw ¶
func BridgeDeposit ¶
func BuildQuery ¶
func CancelProposal ¶
func ConstructErc721DepositData ¶
constructErc20Data constructs the data field to be passed into an erc721 deposit call
func DeployBridge ¶
func DeployERC20Handler ¶
func DeployERC20Token ¶
func DeployERC721Handler ¶
func DeployGenericHandler ¶
func ERC20AddMinter ¶
func ERC20Allowance ¶
func ERC20Approve ¶
func ERC20BalanceOf ¶
func ERC20IsMinter ¶
func ERC20MinterRole ¶
func ERC20Transfer ¶
func ERC20Transfer(client *client.Client, erc20 *erc20.ERC20PresetMinterPauser, recipient common.Address, amount *big.Int) (*types.Transaction, error)
nolint
func ERC721AddMinter ¶
func ERC721Approve ¶
func ERC721Mint ¶
func ERC721MinterRole ¶
func ERC721OwnerOf ¶
func Erc20AddMinter ¶
func Erc20Approve ¶
func GetSolidityFunctionSig ¶
func IsExecuted ¶
func MakeAndSendERC20Deposit ¶
func MakeErc20Deposit ¶
func MintTokens ¶
func QueryProposal ¶
func QueryResource ¶
func RegisterGenericResource ¶
func RegisterResource ¶
func RlpEncodeHeader ¶
RlpEncodeHeader is method to RLP encode data stored in a block header
func SetBurnable ¶
func Simulate ¶
func Simulate(client *client.Client, block *big.Int, txHash common.Hash, from common.Address) ([]byte, error)
Simulate function gets transaction info by hash and then executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain. Execution happens against provided block.
func SliceTo32Bytes ¶
func SliceTo4Bytes ¶
func UserAmountToWei ¶
UserAmountToWei converts decimal user friendly representation of token amount to 'Wei' representation with provided amount of decimal places eg UserAmountToWei(1, 5) => 100000
func WaitAndReturnTxReceipt ¶
WaitForTx will query the chain at ExpectedBlockTime intervals, until a receipt is returned. Returns an error if the tx failed.
Types ¶
type DeployedContracts ¶
type DeployedContracts struct { BridgeAddress common.Address ERC20HandlerAddress common.Address ERC721HandlerAddress common.Address GenericHandlerAddress common.Address ERC20TokenAddress common.Address }
func DeployContracts ¶
func DeployContracts(client *client.Client, chainID uint8, initialRelayerThreshold *big.Int, relayerAddresses []common.Address, erc20Name, erc20Symbol string, bridgeFee *big.Int) (*DeployedContracts, error)
DeployContracts deploys Bridge, Relayer, ERC20Handler, ERC721Handler and CentrifugeAssetHandler and returns the addresses
type MerkleProof ¶
type Message ¶
type Message struct { Source ChainId // Source where message was initiated Destination ChainId // Destination chain of message Type TransferType // type of bridge transfer DepositNonce Nonce // Nonce for the deposit ResourceId ResourceId MPParams *MerkleProof SVParams *SignatureVerification Payload []interface{} // data associated with event sequence }
Message is used as a generic format to communicate between chains
func NewFungibleTransfer ¶
func NewFungibleTransfer(source, dest ChainId, nonce Nonce, resourceId ResourceId, mp *MerkleProof, sv *SignatureVerification, amount *big.Int, recipient []byte) *Message
func NewGenericTransfer ¶
func NewGenericTransfer(source, dest ChainId, nonce Nonce, resourceId ResourceId, mp *MerkleProof, sv *SignatureVerification, metadata []byte) *Message
func NewNonFungibleTransfer ¶
func NewNonFungibleTransfer(source, dest ChainId, nonce Nonce, resourceId ResourceId, mp *MerkleProof, sv *SignatureVerification, tokenId *big.Int, recipient, metadata []byte) *Message
type ProposalStatus ¶
type ProposalStatus int
const ( Inactive ProposalStatus = iota Active Passed Executed Cancelled )
type ResourceId ¶
type ResourceId [32]byte
func (*ResourceId) Hex ¶
func (r *ResourceId) Hex() string
type SignatureVerification ¶
type TransferType ¶
type TransferType string
var FungibleTransfer TransferType = "FungibleTransfer"
var GenericTransfer TransferType = "GenericTransfer"
var NonFungibleTransfer TransferType = "NonFungibleTransfer"