Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@JoshOrndorff
Copy link
Contributor

@JoshOrndorff JoshOrndorff commented Apr 15, 2020

This PR adds the ability to host DOTs to the test parachain using the APIs introduced in #80

@JoshOrndorff
Copy link
Contributor Author

I've got something that can almost be played with, but I can't figure out how to create Alice's AccountId in the runtime.

impl<T: Trait> DownwardMessageHandler for Module<T> {
	fn handle_downward_message(msg: &()) {
		// This will be fleshed out once non-trivial messages are supported.
		// For now, every incoming message represents an inbound transfer of 10 DOTs for Alice.

		// TODO decode these parameters from the message rather than setting them manually.
		//GRRRRRR How the heck do I make Alice's accountID!?
		let dest = sr25519::Pair::from_string(&"//Alice", None)
			.expect("static values are valid; qed")
			.public()
			.into_account();
		let value = T::Balance::from(10);

		// Mint new tokens in the parachain
		Balances::<T>::insert(&dest, Balances::<T>::get(&dest) + value);

		// Emit event for successful inbound token transfer
		Self::deposit_event(RawEvent::TransferIn(dest, value));
	}
}

@JoshOrndorff
Copy link
Contributor Author

Closing this in favor of #118

@JoshOrndorff JoshOrndorff deleted the joshy-wrapped-dot branch August 5, 2020 14:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants