nim-nitro/nitro/protocol/channel.nim
Mark Spanbroek 5977ea47e3 Update to latest version of nim-contract-abi
Encoding is rewritten to make use of the new tuple api.
2021-12-06 15:39:27 +01:00

19 lines
407 B
Nim

import pkg/nimcrypto
import ../basics
import ./abi
push: {.upraises:[].}
export basics
type
ChannelDefinition* = object
nonce*: UInt48
participants*: seq[EthAddress]
chainId*: UInt256
func getChannelId*(channel: ChannelDefinition): Destination =
let encoding = AbiEncoder.encode:
(channel.chainId, channel.participants, channel.nonce)
Destination(keccak256.digest(encoding).data)