Skip to content

Commit

Permalink
Feat/gear
Browse files Browse the repository at this point in the history
  • Loading branch information
jsamol authored and godenzim committed Apr 11, 2024
1 parent 467d466 commit edb952f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Project.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object Project {
const val group = "com.github.acurast"
const val version = "0.1.18"
const val version = "0.1.19-beta01"
}
39 changes: 39 additions & 0 deletions codec/src/main/kotlin/acurast/codec/extrinsic/gear.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package acurast.codec.extrinsic

import acurast.codec.extensions.calculateHashCode
import acurast.codec.extensions.equals
import acurast.codec.extensions.toU8a
import acurast.codec.type.ExtrinsicCall
import acurast.codec.type.UInt128
import acurast.codec.type.UInt64

public data class GearSendMessage(
val callIndex: ByteArray,
val destination: ByteArray,
val payload: ByteArray,
val gasLimit: UInt64,
val value: UInt128,
val keepAlive: Boolean,
) : ExtrinsicCall {
override fun toU8a(): ByteArray =
callIndex + destination + payload.toU8a() + gasLimit.toU8a() + value.toU8a() + keepAlive.toU8a()

override fun equals(other: Any?): Boolean =
equals(other) {
callIndex.contentEquals(it.callIndex)
&& destination.contentEquals(it.destination)
&& payload.contentEquals(it.payload)
&& gasLimit == it.gasLimit
&& value == it.value
&& keepAlive == it.keepAlive
}

override fun hashCode(): Int = listOf(
callIndex.contentHashCode(),
destination.contentHashCode(),
payload.contentHashCode(),
gasLimit.hashCode(),
value.hashCode(),
keepAlive.hashCode(),
).calculateHashCode()
}

0 comments on commit edb952f

Please sign in to comment.