Skip to content

Commit

Permalink
fix sync error
Browse files Browse the repository at this point in the history
  • Loading branch information
donguks committed Oct 7, 2021
1 parent 561b829 commit 071e715
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,8 @@ type IncentivePool @entity {
id: ID!
reserve: Reserve!
}

type Tokenizer @entity {
id: ID!
reserve: Reserve!
}
3 changes: 2 additions & 1 deletion src/mappings/MoneyPoolMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
DToken,
ReserveHistory,
IncentivePool,
Tokenizer
} from '../../generated/schema';
import {
findOrCreateUser
Expand Down Expand Up @@ -54,7 +55,7 @@ export function handleNewReserve(event: NewReserve): void {
dToken.save();

TokenizerTemplate.create(event.params.tokenizer);
let tokenizer = new AssetBondToken(event.params.tokenizer.toHex());
let tokenizer = new Tokenizer(event.params.tokenizer.toHex());
tokenizer.reserve = reserve.id;
tokenizer.save();

Expand Down
11 changes: 7 additions & 4 deletions src/mappings/TokenizerMapping.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {
import {
EmptyAssetBondMinted,
AssetBondCollateralized,
AssetBondLiquidated,
AssetBondReleased,
AssetBondSettled,
AssetBondSigned
} from '../../generated/templates/Tokenizer/Tokenizer'
AssetBondSigned,
} from '../../generated/templates/Tokenizer/Tokenizer'
import {
AssetBondToken
AssetBondToken,
Tokenizer
} from '../../generated/schema';
import {
findOrCreateUser
Expand All @@ -26,9 +27,11 @@ enum AssetBondTokenState {
export function handleEmptyAssetBondMinted(event: EmptyAssetBondMinted): void {
let assetBondToken = new AssetBondToken(event.params.tokenId.toString())
let collateralServiceProvider = findOrCreateUser(event.params.account.toHex());
let tokenizer = Tokenizer.load(event.transaction.to.toHex());

assetBondToken.collateralServiceProvider = collateralServiceProvider.id;
assetBondToken.state = AssetBondTokenState.EMPTY;
assetBondToken.reserve = tokenizer.reserve;

assetBondToken.save();
}
Expand Down

0 comments on commit 071e715

Please sign in to comment.