Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_pair #25

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions components/uniswap_v2_factory_contract/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ mod uniswap_v2_factory{
// #[ink(message)]
// fn all_pairs_length(&mut self) -> u64;

// #[ink(message)]
// fn create_pair(&mut self, token_a: AccountId, token_b: AccountId) -> AccountId;
#[ink(message)]
fn create_pair(&mut self, token_a: AccountId, token_b: AccountId) -> AccountId;

#[ink(message)]
fn set_fee_to(&mut self, address: AccountId);
Expand Down Expand Up @@ -78,24 +78,28 @@ mod uniswap_v2_factory{


impl IUniswapV2Factory for UniswapV2Factory {




// #[ink(message)] //-> UniswapFactoryResult<()>
// fn create_pair(&mut self, token_a: AccountId, token_b: AccountId) {
// if token_a != token_b {
// // Conditional Operator (? :)
// // The conditional operator first evaluates an expression for a true or false value and then executes
// // one of the two given statements depending upon the result of the evaluation.

// if token_b > token_a {
// let token0: AccountId = token_a;
// let token1: AccountId = token_b;
// }
// else {
// let token0: AccountId = token_b;
// let token1: AccountId = token_a;
// }
#[ink(message)] //-> UniswapFactoryResult<()>
fn create_pair(&mut self, token_a: AccountId, token_b: AccountId) {
if token_a != token_b {
// Conditional Operator (? :)
// The conditional operator first evaluates an expression for a true or false value and then executes
// one of the two given statements depending upon the result of the evaluation.

if token_b > token_a {
let token0: AccountId = token_a;
let token1: AccountId = token_b;
}
else {
let token0: AccountId = token_b;
let token1: AccountId = token_a;
}


}
}

// todo!();

Expand Down