-
Notifications
You must be signed in to change notification settings - Fork 202
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
[fortuna] Withdraw fees #1610
[fortuna] Withdraw fees #1610
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
&provider_info, | ||
provider_config | ||
.fee_manager | ||
.unwrap_or(Address::from([0u8; 20])), |
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.
Address::zero()
config.keeper.private_key.load()?.ok_or(anyhow!("Please specify a keeper private key in the config or omit the --keeper option to use the provider private key"))? | ||
} else { | ||
config.provider.private_key.load()?.ok_or(anyhow!( | ||
"Please specify a provider private key in the config or provide the --keeper option to use the keeper private key instead. " |
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.
nit: extra space at the end of string
contract.wallet().address() | ||
); | ||
|
||
if is_fee_manager { |
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.
this part has a bit of repeated logic. Can refactor into something like this:
let call = match is_fee_manager {
true => contract.withdraw_as_fee_manager(provider_address, withdrawal_amount_wei),
false => contract.withdraw(withdrawal_amount_wei),
};
let tx_result = call.send()
.await?
.await?;
log_tx_hash(&tx_result);
apps/fortuna/src/keeper.rs
Outdated
|
||
let fees = provider_info.accrued_fees_in_wei; | ||
|
||
let min_balance = U256::from(12345); |
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.
We should probably read this from some config
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.
whoops
.await | ||
.map_err(|e| anyhow!("Error while getting provider info. error: {:?}", e))?; | ||
|
||
let fees = provider_info.accrued_fees_in_wei; |
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.
we should add some check that the fee_manager is actually the keeper. Otherwise, we may get confusing revert errors
apps/fortuna/src/keeper.rs
Outdated
@@ -837,3 +846,68 @@ pub async fn track_provider( | |||
}) | |||
.set(end_sequence_number as i64); | |||
} | |||
|
|||
// TODO: fields |
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.
no fields necessary here. We only want the chain_id
and if you add in_current_span
when you are spawning this, it should be enough.
Add logic to withdraw fees. Couple related features here: