-
Notifications
You must be signed in to change notification settings - Fork 115
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
[OTE-762] Affiliates comlink affiliate info #2269
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
368742b
modify affiliate api stubs
jerryfan01234 bc16518
implement comlink GET affiliates/metadata
jerryfan01234 0a16cad
Merge branch 'main' into affiliates-comlink-metadata
jerryfan01234 ac62c32
tests
jerryfan01234 f321a91
Merge branch 'main' into affiliates-comlink-metadata
jerryfan01234 0784cfa
revert package.json
jerryfan01234 21481ec
lint fix
jerryfan01234 3fa0437
replace affiliates address and total_volume stubs with real implement…
jerryfan01234 5e7e139
Merge branch 'main' into affiliates-comlink-total-volume
jerryfan01234 93d3f83
replace affiliates snapshot stub with real implementation
jerryfan01234 dd9d66c
Merge branch 'main' into affiliates-comlink-affiliate-info
jerryfan01234 6ca6830
pr revision
jerryfan01234 3ef1eed
Merge branch 'main' into affiliates-comlink-affiliate-info
jerryfan01234 b344fa0
pr revision 2
jerryfan01234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...s/20240913142157_change_affiliate_info_decimal_precision_and_add_total_referred_volume.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as Knex from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
return knex.schema.alterTable('affiliate_info', (table) => { | ||
// null indicates variable precision whereas not specifying will result in 8,2 precision,scale | ||
table.decimal('affiliateEarnings', null).alter(); | ||
table.decimal('totalReferredFees', null).alter(); | ||
table.decimal('referredNetProtocolEarnings', null).alter(); | ||
|
||
table.decimal('referredTotalVolume', null).notNullable(); | ||
}); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
return knex.schema.alterTable('affiliate_info', (table) => { | ||
table.decimal('affiliateEarnings').alter(); | ||
table.decimal('totalReferredFees').alter(); | ||
table.decimal('referredNetProtocolEarnings').alter(); | ||
|
||
table.dropColumn('referredTotalVolume'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
what does variable precision mean? Thinking about this more, we probably want scale of 6 for all fees, thats the smallest unit of USDC
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.
For variable precision it will not append any 0s after the decimal. Eg. 2 stays 2 and 2.123 stays 2.123. Variable precision allows for up to the maximum postgres limit.
If you set the precision to 6. It will pad 0s so 2 -> 2.000000.
We can do it either way, the main change will be that our unit tests use the string conversion so we have to change those values. I prefer to stick with variable, as that is convention other columns in our tables use.