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

Faucet Referral Codes #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Aerilym
Copy link
Collaborator

@Aerilym Aerilym commented Aug 1, 2024

Reverts #29

Comment on lines +193 to +199
db.prepare(
`CREATE INDEX IF NOT EXISTS operator_index ON ${TABLE.TRANSACTIONS} (${TRANSACTIONS_TABLE.WALLET}, ${TRANSACTIONS_TABLE.TIMESTAMP}) WHERE ${TRANSACTIONS_TABLE.WALLET} IS NOT NULL;`
).run();

db.prepare(
`CREATE INDEX IF NOT EXISTS operator_index ON ${TABLE.TRANSACTIONS} (${TRANSACTIONS_TABLE.TARGET}, ${TRANSACTIONS_TABLE.TIMESTAMP}, ${TRANSACTIONS_TABLE.CODE}) WHERE ${TRANSACTIONS_TABLE.CODE} IS NOT NULL;`
).run();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've got two use 2 different names, otherwise the second one is never created!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe operator_target ?

.prepare<string>(
`SELECT ${CODE_TABLE.ID}, ${CODE_TABLE.WALLET}, ${CODE_TABLE.DRIP}, ${CODE_TABLE.MAXUSES} FROM ${TABLE.CODE} WHERE ${CODE_TABLE.ID} = ?`
)
.all(code)[0] as CodeDetails;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use
https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#getbindparameters---row
when you need one item at most and not all the rows?

);
}

const { wallet, maxuses, drip: codeDrip } = getReferralCodeDetails({ db, code });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxUses?

Comment on lines +240 to +241
codeTransactionHistory.filter((transaction) => transaction.target === targetAddress)
.length >= 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
codeTransactionHistory.filter((transaction) => transaction.target === targetAddress)
.length >= 1
codeTransactionHistory.some((transaction) => transaction.target === targetAddress)

@Aerilym Aerilym changed the base branch from main to dev August 8, 2024 06:34
@Aerilym Aerilym deleted the branch main September 2, 2024 01:17
@Aerilym Aerilym closed this Sep 2, 2024
@Aerilym Aerilym reopened this Sep 2, 2024
@Aerilym Aerilym added enhancement New feature or request staking Changes to the Staking app labels Sep 2, 2024
Base automatically changed from dev to main September 10, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request staking Changes to the Staking app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants