Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
fix: integrate with exact contract method in reward page
Browse files Browse the repository at this point in the history
  • Loading branch information
sincerely91 authored and stiartsly committed Apr 19, 2022
1 parent d55f807 commit d4a8ada
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
21 changes: 15 additions & 6 deletions src/components/ContractMethod/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,23 @@ export const callTokenomicsContractMethod = (walletConnectWeb3: Web3, param: Typ
case 'withdraw':
contractMethod = smartContract.methods.withdraw();
break;
case 'getTotalRewardAsBuyer':
contractMethod = smartContract.methods.getTotalRewardAsBuyer(accounts[0]);
case 'getAvailableRewardAsBuyer':
contractMethod = smartContract.methods.getAvailableRewardAsBuyer(accounts[0]);
break;
case 'getTotalRewardAsCreator':
contractMethod = smartContract.methods.getTotalRewardAsCreator(accounts[0]);
case 'getAvailableRewardAsCreator':
contractMethod = smartContract.methods.getAvailableRewardAsCreator(accounts[0]);
break;
case 'getTotalRewardAsStaker':
contractMethod = smartContract.methods.getTotalRewardAsStaker(accounts[0]);
case 'getAvailableRewardAsStaker':
contractMethod = smartContract.methods.getAvailableRewardAsStaker(accounts[0]);
break;
case 'getReceivedRewardAsBuyer':
contractMethod = smartContract.methods.getReceivedRewardAsBuyer(accounts[0]);
break;
case 'getReceivedRewardAsCreator':
contractMethod = smartContract.methods.getReceivedRewardAsCreator(accounts[0]);
break;
case 'getReceivedRewardAsStaker':
contractMethod = smartContract.methods.getReceivedRewardAsStaker(accounts[0]);
break;
case 'withdrawBuyerReward':
contractMethod = smartContract.methods.withdrawBuyerReward();
Expand Down
12 changes: 6 additions & 6 deletions src/pages/RewardsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const RewardsPage: React.FC = (): JSX.Element => {
...blankContractMethodParam,
contractType: 4,
callType: 2,
method: 'getTotalRewardAsBuyer',
method: 'getReceivedRewardAsBuyer',
})
.then((_receivedReward: string) => {
if (!unmounted) {
Expand All @@ -101,7 +101,7 @@ const RewardsPage: React.FC = (): JSX.Element => {
...blankContractMethodParam,
contractType: 4,
callType: 2,
method: 'getTotalRewardAsBuyer',
method: 'getAvailableRewardAsBuyer',
});
})
.then((_availableReward: string) => {
Expand All @@ -116,7 +116,7 @@ const RewardsPage: React.FC = (): JSX.Element => {
...blankContractMethodParam,
contractType: 4,
callType: 2,
method: 'getTotalRewardAsBuyer',
method: 'getReceivedRewardAsCreator',
});
})
.then((_receivedReward: string) => {
Expand All @@ -131,7 +131,7 @@ const RewardsPage: React.FC = (): JSX.Element => {
...blankContractMethodParam,
contractType: 4,
callType: 2,
method: 'getTotalRewardAsBuyer',
method: 'getAvailableRewardAsCreator',
});
})
.then((_availableReward: string) => {
Expand All @@ -146,7 +146,7 @@ const RewardsPage: React.FC = (): JSX.Element => {
...blankContractMethodParam,
contractType: 4,
callType: 2,
method: 'getTotalRewardAsBuyer',
method: 'getReceivedRewardAsStaker',
});
})
.then((_receivedReward: string) => {
Expand All @@ -161,7 +161,7 @@ const RewardsPage: React.FC = (): JSX.Element => {
...blankContractMethodParam,
contractType: 4,
callType: 2,
method: 'getTotalRewardAsBuyer',
method: 'getAvailableRewardAsStaker',
});
})
.then((_availableReward: string) => {
Expand Down

0 comments on commit d4a8ada

Please sign in to comment.