File tree 6 files changed +22
-28
lines changed
6 files changed +22
-28
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,11 @@ export function calculateDistributorPoints(
40
40
principal : BigInt ,
41
41
prevDistributorPoints : BigInt ,
42
42
updatedAtBlock : BigInt ,
43
- rewardsUpdatedAtBlock : BigInt ,
43
+ fromBlock : BigInt ,
44
44
currentBlock : BigInt
45
45
) : BigInt {
46
- if ( rewardsUpdatedAtBlock . ge ( updatedAtBlock ) ) {
47
- return principal . times ( currentBlock . minus ( rewardsUpdatedAtBlock ) ) ;
46
+ if ( fromBlock . ge ( updatedAtBlock ) ) {
47
+ return principal . times ( currentBlock . minus ( fromBlock ) ) ;
48
48
}
49
49
50
50
return prevDistributorPoints . plus (
Original file line number Diff line number Diff line change @@ -5,10 +5,8 @@ import {
5
5
Validator ,
6
6
OperatorAllocation ,
7
7
} from "../../generated/schema" ;
8
- import {
9
- calculateDistributorPoints ,
10
- createOrLoadMerkleDistributor ,
11
- } from "./merkleDistributor" ;
8
+ import { calculateDistributorPoints } from "./merkleDistributor" ;
9
+ import { createOrLoadRewardEthToken } from "./rewardEthToken" ;
12
10
13
11
export function createOrLoadOperator (
14
12
operatorAddress : Address ,
@@ -32,12 +30,12 @@ export function createOrLoadOperator(
32
30
operator . updatedAtTimestamp = BIG_INT_ZERO ;
33
31
operator . save ( ) ;
34
32
} else {
35
- let distributor = createOrLoadMerkleDistributor ( ) ;
33
+ let rewardEthToken = createOrLoadRewardEthToken ( ) ;
36
34
operator . distributorPoints = calculateDistributorPoints (
37
35
operator . revenueShare . times ( operator . validatorsCount ) ,
38
36
operator . distributorPoints ,
39
37
operator . updatedAtBlock ,
40
- distributor . rewardsUpdatedAtBlock ,
38
+ rewardEthToken . updatedAtBlock ,
41
39
currentBlock
42
40
) ;
43
41
}
Original file line number Diff line number Diff line change 1
1
import { Address , BigInt , ethereum } from "@graphprotocol/graph-ts" ;
2
2
import { BIG_INT_ZERO } from "const" ;
3
- import {
4
- calculateDistributorPoints ,
5
- createOrLoadMerkleDistributor ,
6
- } from "./merkleDistributor" ;
3
+ import { calculateDistributorPoints } from "./merkleDistributor" ;
7
4
import { Partner , Referrer } from "../../generated/schema" ;
5
+ import { createOrLoadRewardEthToken } from "./rewardEthToken" ;
8
6
9
7
export function loadPartner (
10
8
partnerAddress : Address ,
11
9
currentBlock : BigInt
12
10
) : Partner | null {
13
11
let partner = Partner . load ( partnerAddress . toHexString ( ) ) ;
14
12
if ( partner != null ) {
15
- let distributor = createOrLoadMerkleDistributor ( ) ;
13
+ let rewardEthToken = createOrLoadRewardEthToken ( ) ;
16
14
partner . distributorPoints = calculateDistributorPoints (
17
15
partner . revenueShare . times ( partner . contributedAmount ) ,
18
16
partner . distributorPoints ,
19
17
partner . updatedAtBlock ,
20
- distributor . rewardsUpdatedAtBlock ,
18
+ rewardEthToken . updatedAtBlock ,
21
19
currentBlock
22
20
) ;
23
21
}
Original file line number Diff line number Diff line change @@ -9,11 +9,9 @@ import {
9
9
CONTRACT_CHECKER_DEPLOYMENT_BLOCK ,
10
10
} from "const" ;
11
11
import { StakeWiseTokenHolder , VestingEscrow } from "../../generated/schema" ;
12
- import {
13
- calculateDistributorPoints ,
14
- createOrLoadMerkleDistributor ,
15
- } from "./merkleDistributor" ;
12
+ import { calculateDistributorPoints } from "./merkleDistributor" ;
16
13
import { ContractChecker } from "../../generated/StakeWiseToken/ContractChecker" ;
14
+ import { createOrLoadRewardEthToken } from "./rewardEthToken" ;
17
15
18
16
export function createOrLoadStakeWiseTokenHolder (
19
17
holderAddress : Address ,
@@ -38,13 +36,13 @@ export function createOrLoadStakeWiseTokenHolder(
38
36
holder . updatedAtTimestamp = BIG_INT_ZERO ;
39
37
holder . save ( ) ;
40
38
} else {
41
- let distributor = createOrLoadMerkleDistributor ( ) ;
39
+ let rewardEthToken = createOrLoadRewardEthToken ( ) ;
42
40
holder . isContract = isContract ;
43
41
holder . distributorPoints = calculateDistributorPoints (
44
42
holder . balance ,
45
43
holder . distributorPoints ,
46
44
holder . updatedAtBlock ,
47
- distributor . rewardsUpdatedAtBlock ,
45
+ rewardEthToken . updatedAtBlock ,
48
46
currentBlock
49
47
) ;
50
48
}
Original file line number Diff line number Diff line change 1
1
import { log } from "@graphprotocol/graph-ts" ;
2
2
import { CONTRACT_CHECKER_ADDRESS , MERKLE_DISTRIBUTOR_ADDRESS } from "const" ;
3
3
import {
4
- createOrLoadMerkleDistributor ,
5
4
createOrLoadNetwork ,
5
+ createOrLoadRewardEthToken ,
6
6
createOrLoadStakeWiseTokenHolder ,
7
7
isSupportedSwiseHolder ,
8
8
} from "../entities" ;
@@ -38,10 +38,10 @@ export function handleTransfer(event: Transfer): void {
38
38
39
39
if ( event . params . from . equals ( MERKLE_DISTRIBUTOR_ADDRESS ) ) {
40
40
// SWISE located in Merkle Distributor belongs to the claimer
41
- let distributor = createOrLoadMerkleDistributor ( ) ;
41
+ let rewardEthToken = createOrLoadRewardEthToken ( ) ;
42
42
toHolder . distributorPoints = toHolder . distributorPoints . plus (
43
43
event . params . value . times (
44
- event . block . number . minus ( distributor . rewardsUpdatedAtBlock )
44
+ event . block . number . minus ( rewardEthToken . updatedAtBlock )
45
45
)
46
46
) ;
47
47
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ dataSources:
18
18
file : ./src/mappings/pool.ts
19
19
entities :
20
20
- Pool
21
- - MerkleDistributor
21
+ - RewardEthToken
22
22
- Partner
23
23
- Referrer
24
24
- DepositActivation
@@ -68,7 +68,7 @@ dataSources:
68
68
entities :
69
69
- Operator
70
70
- OperatorSnapshot
71
- - MerkleDistributor
71
+ - RewardEthToken
72
72
- Validator
73
73
- Network
74
74
abis :
@@ -221,7 +221,7 @@ dataSources:
221
221
file : ./src/mappings/stakeWiseToken.ts
222
222
entities :
223
223
- StakeWiseTokenHolder
224
- - MerkleDistributor
224
+ - RewardEthToken
225
225
- Network
226
226
- VestingEscrow
227
227
abis :
@@ -367,7 +367,7 @@ dataSources:
367
367
- Referrer
368
368
- Operator
369
369
- Network
370
- - MerkleDistributor
370
+ - RewardEthToken
371
371
abis :
372
372
- name : Roles
373
373
file : ./packages/abis/Roles.json
You can’t perform that action at this time.
0 commit comments