-
Notifications
You must be signed in to change notification settings - Fork 1
Blend V2 #35
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
Conversation
mootz12
left a 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.
Looks good - just some feedback around allowance creation
src/bidder_submitter.ts
Outdated
| // Check if the allowance is less than u64 max | ||
| if ( | ||
| amount < BigInt('18446744073709551615') / BigInt(2) || | ||
| expiration < allowance.currLedger + 17368 * 7 | ||
| ) { | ||
| const assetContract = new Contract(allowance.assetId); | ||
| const op = assetContract | ||
| .call( | ||
| 'approve', | ||
| ...[ | ||
| Address.fromString(allowance.filler.keypair.publicKey()).toScVal(), | ||
| Address.fromString(allowance.spender).toScVal(), | ||
| nativeToScVal(BigInt('18446744073709551615'), { type: 'i128' }), | ||
| nativeToScVal(allowance.currLedger + 17368 * 30 * 5, { type: 'u32' }), | ||
| ] | ||
| ) | ||
| .toXDR('base64'); |
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 will submit a lot of unnecessary allowance calls (IE - after each successful fill), burning unnecessary XLM.
maybe just check if its under like BigInt(100_000 * 1e7), and continue making the allowance u64::MAX
src/bidder_handler.ts
Outdated
| const ledgersToFill = auctionEntry.fill_block - nextLedger; | ||
| if (auctionEntry.fill_block === 0 || ledgersToFill <= 5 || ledgersToFill % 10 === 0) { | ||
| // Check is the filler has an active allowance for backstop token | ||
| if (auctionEntry.auction_type === AuctionType.Interest) { |
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.
maybe we only want to send this once when fill_block === 0? The buffer in expiration_ledger ensures the allowance will exist over the next day of blocks, so there is no risk of it expiring beforehand
src/bidder_submitter.ts
Outdated
| const expiration = await sorobanHelper.loadAllowanceExpiration( | ||
| allowance.assetId, | ||
| allowance.filler.keypair.publicKey(), | ||
| allowance.spender | ||
| ); |
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.
should this just load the allowance object in full? We are only interacting with the Comet contract, and we need to load the ledger entry from chain anyway for the expiration_ledger
src/events.ts
Outdated
| POOL_EVENT = 'pool_event', | ||
| USER_REFRESH = 'user_refresh', | ||
| CHECK_USER = 'check_user', | ||
| CHECK_ALLOWANCES = 'check_allowances', |
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.
is this used?
mootz12
left a 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.
LG2M
No description provided.