From e1e4c017fd413332bc4b4cda79302d0d6e7b88d3 Mon Sep 17 00:00:00 2001 From: girazoki Date: Thu, 22 Jul 2021 14:06:23 +0200 Subject: [PATCH] Crowdloan rewards precompiles (#607) * First sketch of claim * Fmt and leftovers * Catching up on tests * First tests working * Crowdloan precompiles start working * New reward info precompile * std in vec * workspace fixing and lint * More fmt * Add to all runtimes * Only moonbase tests working * Forgot ignore in moonriver * Undoing the ignore for moonriver * add tracing subscriber to display logs * precompile add to test * Revert "add tracing subscriber to display logs" This reverts commit 9a3ce4613d736987b448669483068af4621355aa. * Check for target gas when reading storage * Add common package for precompile utils * Update toml file * Add update_reward_address precompile * Add update_reward_address with ignore to rest of the runtimes * fmt * fmt plus other review comments * Better solidity writing * Input bounds * Remove trace log from common function * Clean parachain-staking-precompile traces * Revert introduced error * utils * Revert "Clean parachain-staking-precompile traces" This reverts commit b8867379952baf64a9d25aa1d9ee5641b495f9fc. * Clean parachain-staking * Remove leftovers from previous utils * fmt Co-authored-by: nanocryk <6422796+nanocryk@users.noreply.github.com> --- Cargo.toml | 2 +- src/lib.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0767966af2..6cc9af4927 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,4 +30,4 @@ std = [ "frame-system/std", "pallet-evm/std", "evm/std", -] \ No newline at end of file +] diff --git a/src/lib.rs b/src/lib.rs index f76c2f6878..a82108db39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,6 +120,16 @@ impl OutputBuilder { self.data.extend_from_slice(&buffer); self } + + /// Push a U256 to the output. + pub fn write_bool>(mut self, value: T) -> Self { + let mut buffer = [0u8; 32]; + if value.into() { + buffer[31] = 1; + } + self.data.extend_from_slice(&buffer); + self + } } impl Default for OutputBuilder {