-
Notifications
You must be signed in to change notification settings - Fork 308
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: referral farms #6128
feat: referral farms #6128
Conversation
…eateERC20PairFarm
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
packages/mask/src/plugins/Referral/SNSAdaptor/AdjustFarmRewards.tsx
Outdated
Show resolved
Hide resolved
variant="contained" | ||
size="medium" | ||
className={classes.buttonWithdraw} | ||
onClick={() => console.log('request to withdraw')}> |
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.
Hasn't it been implemented yet?
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.
Yes, this button is disabled now, we decided to postpone withdrawal feature to the next release.
Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
…s.tsx Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
…ce/Maskbook into feat/plugin-referral-farms
Co-authored-by: guanbinrui <52657989+guanbinrui@users.noreply.github.com>
…ce/Maskbook into feat/plugin-referral-farms
if (typeof b === 'number') return BigInt(b) | ||
if (b instanceof Uint8Array) return toBigInt(buf(b)) | ||
if (typeof b === 'string' && b.startsWith('0x')) return BigInt(b) | ||
if (b instanceof BigNumber || (b as any)?._isBigNumber === true) return BigInt(b as any) |
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.
if (b instanceof BigNumber || (b as any)?._isBigNumber === true) return BigInt(b as any) | |
if (b instanceof BigNumber || (b as any)?._isBigNumber === true) return BigInt(b as BigNumber) |
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.
fixed
import { bufToHexString, toBigInt, writeUInt32BE, hexToArrayBuffer } from './buffer' | ||
|
||
function toChainAddress(chainId: BigNumber | bigint, address: Uint8Array): Uint8Array { | ||
if (isValidAddress(address.toString())) throw new Error('invalid address') |
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.
if (isValidAddress(address.toString())) throw new Error('invalid address') | |
if (isValidAddress(bufToHexString(address))) throw new Error('invalid address') |
FYI: The Web3 utils lib has https://web3js.readthedocs.io/en/v1.7.3/web3-utils.html#bytestohex.
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.
bytesToHex(bytes: number[]): string
, address here is address: Uint8Array
.
TS error: Argument of type 'Uint8Array' is not assignable to parameter of type 'number[]'.
Probably do you know some utils to convert Uint8Array to string?
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.
It can expand to an array of numbers. I noticed that the 0x
should add as a prefix.
`0x${bufToHexString(...address)}`
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.
Yes, thanks, done refactoring and use bytestohex
@guanbinrui, thanks for all your suggestions, I resolved all of them. |
Thanks! I will merge it. |
* 'develop' of github.com:etouyang/Maskbook: (173 commits) feat: more debugger connection actions (DimensionDev#6438) fix: sign tx by wallet with mnemonic words (DimensionDev#6437) fix: sign arbitrary message (DimensionDev#6436) fix: bugfix for refactor (DimensionDev#6434) fix: lost overrides (DimensionDev#6435) feat: add useAccountName (DimensionDev#6429) fix: button logic under EVM chain (DimensionDev#6431) fix: gas price fallback (DimensionDev#6432) chore: update node-version for workspace (DimensionDev#6428) refactor: social address list (DimensionDev#6410) fix: bugfix for trader (DimensionDev#6424) fix: duplicated db fetch (DimensionDev#6426) docs(i18n): sync i18n files from Crowdin (DimensionDev#6425) fix: tsc need restart to handle new file or removed file in watch mode fix: lint errors feat: referral farms (DimensionDev#6128) fix: fixup maskbox for evm migrate (DimensionDev#6395) fix: pets artblocks plugin (DimensionDev#6393) docs: update compat table refactor: add RecentTransactionComputed (DimensionDev#6420) ... # Conflicts: # packages/dashboard/src/initialization/isolated_bridge.ts # packages/mask/src/extension/dashboard/index.tsx # packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx # packages/mask/src/plugins/Pets/SNSAdaptor/PreviewBox.tsx # packages/mask/src/plugins/Pets/Services/rss3.ts # packages/mask/src/plugins/Pets/hooks/useNfts.ts # packages/shared/src/index.ts
Description
First version of Referral Farms plugin:
Flows that should be tested:
1.1 Increase/decrease the Daily Farm Reward.
1.2 Deposit Additional Farm Rewards.
Create_Farm.mov
Refer_to_Farm_Option_1.mov
Refer_to_Farm_Option_2.mov
Buy_to_Farm_Option_1.mov
Buy_to_Farm_Option_2.mov
E2E flow:
Important: Don't use ETH to buy your ERC20 Referred token, use swap from ERC20 token to your ERC20 Referred token.
Buy_WETH.mov
Note: TESTNET Oracle updates reward every 2 hours. So, you will see your rewards in the My farms tab 2 hours after "Buy Referred token on DEX".
My_farms.mov
The changes outside of Referral Farms plugin:
Small fix in
packages/mask/src/plugins/Trader/SNSAdaptor/trader/TraderDialog.tsx
to supporttraderProps.chainId