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

feat: get usd based selling working #305

Merged
merged 1 commit into from
Jan 26, 2025
Merged

feat: get usd based selling working #305

merged 1 commit into from
Jan 26, 2025

Conversation

monilpat
Copy link
Collaborator

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

@monilpat monilpat merged commit bd6fe08 into sif-dev Jan 26, 2025
3 of 9 checks passed
@monilpat monilpat deleted the cleanup4 branch January 26, 2025 04:31
const priceInUSD = await getPrice(runtime, sourceAsset);
await new Promise(resolve => setTimeout(resolve, 5000));
elizaLogger.info("PriceInUSD:", priceInUSD);
amountInCurrency = parseFloat(((1 / priceInUSD) * amountInCurrency).toFixed(7));
Copy link
Collaborator

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));

Copy link
Collaborator Author

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) {
Copy link
Collaborator

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

Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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));
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants