-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from galacticcouncil/feature/claims
Claims
- Loading branch information
Showing
14 changed files
with
6,365 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
[package] | ||
authors = ['GalacticCouncil'] | ||
description = 'HydraDX Claims Module' | ||
edition = '2018' | ||
homepage = 'https://github.com/galacticcouncil/hack.hydradx-node' | ||
license = 'Unlicense' | ||
name = 'pallet-claims' | ||
repository = 'https://github.com/galacticcouncil/hack.hydradx-node' | ||
version = '2.0.0' | ||
|
||
[package.metadata.docs.rs] | ||
targets = ['x86_64-unknown-linux-gnu'] | ||
|
||
# alias "parity-scale-code" to "codec" | ||
[dependencies.codec] | ||
default-features = false | ||
features = ['derive'] | ||
package = 'parity-scale-codec' | ||
version = '1.3.4' | ||
|
||
[dependencies] | ||
# Substrate dependencies | ||
frame-support = { default-features = false, version = '2.0.0' } | ||
frame-system = { default-features = false, version = '2.0.0' } | ||
frame-benchmarking = { version = "2.0.0", default-features = false, optional = true } | ||
rustc-hex = { version = '2.1.0', default-features = false } | ||
serde = { optional = true, version = '1.0.101', features = ['derive'] } | ||
sp-io = { default-features = false, version = '2.0.0' } | ||
sp-runtime = { default-features = false, version = '2.0.0' } | ||
sp-std = { default-features = false, version = '2.0.0' } | ||
hex = {default-features = false, version = "0.4.2"} | ||
hex-literal = '0.3.1' | ||
lazy_static = {features = ['spin_no_std'], version = "1.4.0"} | ||
|
||
# Local dependencies | ||
primitives = {path = '../../primitives', default-features = false, version = '2.0.0'} | ||
|
||
# ORML dependencies | ||
orml-traits = { default-features = false, version = '0.3.3-dev' } | ||
orml-tokens = { default-features = false, version = '0.3.3-dev' } | ||
orml-utilities = { default-features = false, version = '0.3.3-dev' } | ||
|
||
[dev-dependencies] | ||
sp-core = { default-features = false, version = '2.0.0' } | ||
hex-literal = '0.3.1' | ||
pallet-balances = { version = "2.0.0" } | ||
|
||
[features] | ||
default = ['std'] | ||
std = [ | ||
'codec/std', | ||
'frame-support/std', | ||
'frame-system/std', | ||
'orml-traits/std', | ||
'orml-tokens/std', | ||
'orml-utilities/std', | ||
'primitives/std', | ||
'rustc-hex/std', | ||
'serde/std', | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#![cfg(feature = "runtime-benchmarks")] | ||
|
||
use super::*; | ||
|
||
use codec::Decode; | ||
use frame_benchmarking::benchmarks; | ||
use frame_system::RawOrigin; | ||
use hex_literal::hex; | ||
|
||
benchmarks! { | ||
_ {} | ||
|
||
claim { | ||
let alice_id = hex!["d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"]; | ||
let caller = T::AccountId::decode(&mut &alice_id[..]).unwrap_or_default(); | ||
let eth_address = EthereumAddress(hex!["8202c0af5962b750123ce1a9b12e1c30a4973557"]); | ||
let signature = hex!["ef9816023122208983c11e596446874df3d400d2f9e380a831206d0e91bfb96d54db352fbd62d3cfa8d8674cf63e6a32052ef3cab038e1e7398eac3d048ed5181c"]; | ||
Claims::<T>::insert(eth_address, 1_000_000_000_000_000_000); | ||
}: _(RawOrigin::Signed(caller.clone()), EcdsaSignature(signature)) | ||
verify { | ||
assert_eq!(T::Currency::free_balance(0, &caller), 2_152_921_504_606_846_976); | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::tests::{new_test_ext, Test}; | ||
use frame_support::assert_ok; | ||
|
||
#[test] | ||
fn test_benchmarks() { | ||
new_test_ext().execute_with(|| { | ||
assert_ok!(test_benchmark_claim::<Test>()); | ||
}); | ||
} | ||
} |
Oops, something went wrong.