diff --git a/secretk/src/commonMain/kotlin/io/eqoty/secretk/types/Coin.kt b/secretk/src/commonMain/kotlin/io/eqoty/secretk/types/Coin.kt index a842bb1..e0da5b2 100644 --- a/secretk/src/commonMain/kotlin/io/eqoty/secretk/types/Coin.kt +++ b/secretk/src/commonMain/kotlin/io/eqoty/secretk/types/Coin.kt @@ -26,6 +26,12 @@ data class Coin( } } + operator fun plus(increment: BigInteger): Coin { + return this.copy( + amount = (BigInteger.parseString(amount, 10) + increment).toString() + ) + } + operator fun minus(increment: Coin): Coin { return if (increment.denom == denom) { this.copy( @@ -39,6 +45,12 @@ data class Coin( } } + operator fun minus(increment: BigInteger): Coin { + return this.copy( + amount = (BigInteger.parseString(amount, 10) - increment).toString() + ) + } + operator fun times(increment: Coin): Coin { return if (increment.denom == denom) { this.copy( @@ -52,6 +64,12 @@ data class Coin( } } + operator fun times(increment: BigInteger): Coin { + return this.copy( + amount = (BigInteger.parseString(amount, 10) * increment).toString() + ) + } + operator fun div(increment: Coin): Coin { return if (increment.denom == denom) { this.copy( @@ -65,4 +83,9 @@ data class Coin( } } + operator fun div(increment: BigInteger): Coin { + return this.copy( + amount = (BigInteger.parseString(amount, 10) / increment).toString() + ) + } } \ No newline at end of file