2021-02-22 15:32:48 +01:00
|
|
|
import pkg/nimcrypto
|
2021-03-09 11:07:35 +01:00
|
|
|
import ../basics
|
2021-02-22 15:32:48 +01:00
|
|
|
import ./abi
|
|
|
|
|
|
2025-12-10 20:44:01 +01:00
|
|
|
{.push raises: [].}
|
2021-03-03 10:30:07 +01:00
|
|
|
|
2021-03-09 11:07:35 +01:00
|
|
|
export basics
|
2021-02-22 15:32:48 +01:00
|
|
|
|
|
|
|
|
type
|
2021-03-09 12:41:51 +01:00
|
|
|
ChannelDefinition* = object
|
2021-02-22 15:32:48 +01:00
|
|
|
nonce*: UInt48
|
|
|
|
|
participants*: seq[EthAddress]
|
|
|
|
|
chainId*: UInt256
|
|
|
|
|
|
2021-03-17 12:22:00 +01:00
|
|
|
func getChannelId*(channel: ChannelDefinition): Destination =
|
2021-12-06 15:39:27 +01:00
|
|
|
let encoding = AbiEncoder.encode:
|
|
|
|
|
(channel.chainId, channel.participants, channel.nonce)
|
|
|
|
|
Destination(keccak256.digest(encoding).data)
|