-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: get usd based selling working #305
Conversation
const priceInUSD = await getPrice(runtime, sourceAsset); | ||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
elizaLogger.info("PriceInUSD:", priceInUSD); | ||
amountInCurrency = parseFloat(((1 / priceInUSD) * amountInCurrency).toFixed(7)); |
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.
I haven't run it on my machine but are we sure about this equation? I'd rather say
amountInCurrency = parseFloat((priceInUSD * amountInCurrency).toFixed(7));
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 are sure as I have transfered and it worked as expected got $0.10 worth of ETH etc
@@ -423,7 +423,7 @@ export async function executeTransferAndCharityTransfer( | |||
const assetIdLowercase = sourceAsset.toLowerCase(); | |||
|
|||
let charityTransfer: Transfer; | |||
if (charityAddress && charityAmount > 0) { | |||
if (false) { |
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.
Why is that? If we want to keep that code for later refactor, let's leave TODO comment
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.
When transfers are too small it fails so removing for now will add it back in this weekend don't worry :)
@@ -423,7 +423,7 @@ export async function executeTransferAndCharityTransfer( | |||
const assetIdLowercase = sourceAsset.toLowerCase(); | |||
|
|||
let charityTransfer: Transfer; | |||
if (charityAddress && charityAmount > 0) { | |||
if (false) { |
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.
disable for now
@@ -423,7 +423,7 @@ export async function executeTransferAndCharityTransfer( | |||
const assetIdLowercase = sourceAsset.toLowerCase(); | |||
|
|||
let charityTransfer: Transfer; | |||
if (charityAddress && charityAmount > 0) { | |||
if (false) { |
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.
When transfers are too small it fails so removing for now will add it back in this weekend don't worry :)
const priceInUSD = await getPrice(runtime, sourceAsset); | ||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
elizaLogger.info("PriceInUSD:", priceInUSD); | ||
amountInCurrency = parseFloat(((1 / priceInUSD) * amountInCurrency).toFixed(7)); |
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 are sure as I have transfered and it worked as expected got $0.10 worth of ETH etc
Relates to
Risks
Background
What does this PR do?
What kind of change is this?
Documentation changes needed?
Testing
Where should a reviewer start?
Detailed testing steps