This Airdrop crate makes it easy to perform an airdrop from a Komodo Platform Assetchain, using KMD or any other assetchain.
```rust extern crate komodo_airdrop;
fn main() {
let snapshot = komodoairdrop::Snapshot::builder()
.onchain(Chain::CHAIN)
.excludeaddresses(vec![
String::from("REbwjC5mfQBRevH78CuRjcvQudxa3ii5Ma"),
String::from("RU9F2EdDzUNK4LUMgjLTMDmtCmDK1a9vrY"),
String::from("RYEufBcEUsofxwt4bGUdroRGmAQxBR8aJG")
])
.usingthreshold(1.0) // only include addresses that contain at least 1 CHAIN
.build()
.unwrap();
let airdrop = komodo_airdrop::Airdrop::builder()
.using_chain(Chain::KMD)
.include_interest(true)
.using_snapshot(&snapshot)
.fund_address("RQT7m4jcnWQxwqQQzh77WKNCuZotkRkAuk")
.payout_ratio(0.75)
.build()
.unwrap();
} ```
If an airdrop happens from a multisig address (starts with b
):
```rust
let signingstring = airdrop.signingstring(Some(String::from("
```
If not:
rust
let signing_string = airdrop.signing_string(None);
println!("{}", signing_string);
signing_string
creates a raw transaction from the inputs of all utxos in the fund_address
, and uses the resulting hex (a running daemon of the fund_address blockchain is required)
to create a string that can be used as parameter string for the signrawtransaction
daemon RPC, where in case of a multisig, a private key (WIF) needs to be supplied manually by the signer.
build()
nowratio
and amount
in Airdrop