-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] disable_coin
should fail if there are tokens dependent on the platform
#1651
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix! Just have one suggestion :)
Also a question about calling cancel
on init_standalone_coin
, it seems that this also removes dependant tokens. Is this the required behaviour for v2 coin initialization?
|
disable_coin
should fail if there are tokens dependent on the platformdisable_coin
should fail if there are tokens dependent on the platform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last question/suggestion that would require others input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected response returned here
smk762@pig:~/mm2_777$ ./disable.sh BCH
{"error":"There are currently matching orders, active swaps, or tokens dependent on 'BCH'","orders":{"matching":[],"cancelled":[]},"active_swaps":[],"dependent_tokens":["ASLP-SLP"]}
smk762@pig:~/mm2_777$ ./disable.sh IRIS
{"error":"There are currently matching orders, active swaps, or tokens dependent on 'IRIS'","orders":{"matching":[],"cancelled":[]},"active_swaps":[],"dependent_tokens":["ATOM-IBC_IRIS"]}
smk762@pig:~/mm2_777$ ./disable.sh ETH
{"error":"There are currently matching orders, active swaps, or tokens dependent on 'ETH'","orders":{"matching":[],"cancelled":[]},"active_swaps":[],"dependent_tokens":["APE-ERC20","BCH-ERC20","BUSD-ERC20","MINDS-ERC20"]}
smk762@pig:~/mm2_777$ ./disable.sh MATIC
{"error":"There are currently matching orders, active swaps, or tokens dependent on 'MATIC'","orders":{"matching":[],"cancelled":[]},"active_swaps":[],"dependent_tokens":["AAVE-PLG20","PGX-PLG20"]}
/// Get enabled coins to disable. | ||
pub async fn get_tokens_to_disable(&self, ticker: &str) -> HashSet<String> { | ||
/// If `ticker` is a platform coin, returns tokens dependent on it. | ||
pub async fn get_dependent_tokens(&self, ticker: &str) -> HashSet<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub async fn get_dependent_tokens(&self, ticker: &str) -> HashSet<String> { | |
pub async fn get_platform_coin_tokens(&self, ticker: &str) -> HashSet<String> { |
let dependent_tokens = coins_ctx.get_dependent_tokens(&ticker).await; | ||
if !dependent_tokens.is_empty() { | ||
return ERR!("There are tokens dependent on '{}': {:?}", ticker, dependent_tokens); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let dependent_tokens = coins_ctx.get_dependent_tokens(&ticker).await; | |
if !dependent_tokens.is_empty() { | |
return ERR!("There are tokens dependent on '{}': {:?}", ticker, dependent_tokens); | |
} | |
let platform_coin_tokens = coins_ctx.get_platform_coin_tokens(&ticker).await; | |
if !platform_coin_tokens.is_empty() { | |
return ERR!("There are tokens dependent on '{}': {:?}", ticker, platform_coin_tokens); | |
} |
The original PR - #1649