-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drops duplicate abi generation adds a dummy definition for local builds updates abis Signed-off-by: stadolf <[email protected]>
- Loading branch information
1 parent
8b1d945
commit f38c2c2
Showing
8 changed files
with
436 additions
and
276 deletions.
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
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,45 @@ | ||
import { BigInt } from '@graphprotocol/graph-ts' | ||
import { IERC20Metadata } from '../generated/CrowdSale/IERC20Metadata' | ||
|
||
import { ERC20Token, IPT, TimelockedToken } from '../generated/schema' | ||
|
||
export function makeTimelockedToken( | ||
_contract: IERC20Metadata, | ||
underlyingToken: ERC20Token | ||
): TimelockedToken { | ||
let token = TimelockedToken.load(_contract._address) | ||
|
||
if (!token) { | ||
token = new TimelockedToken(_contract._address) | ||
token.id = _contract._address | ||
token.decimals = BigInt.fromI32(_contract.decimals()) | ||
token.symbol = _contract.symbol() | ||
token.name = _contract.name() | ||
token.underlyingToken = underlyingToken.id | ||
|
||
let ipt = IPT.load(underlyingToken.id.toHexString()) | ||
if (ipt) { | ||
token.ipt = ipt.id | ||
ipt.lockedToken = token.id | ||
ipt.save() | ||
} | ||
token.save() | ||
} | ||
|
||
return token | ||
} | ||
|
||
export function makeERC20Token(_contract: IERC20Metadata): ERC20Token { | ||
let token = ERC20Token.load(_contract._address) | ||
|
||
if (!token) { | ||
token = new ERC20Token(_contract._address) | ||
token.id = _contract._address | ||
token.decimals = BigInt.fromI32(_contract.decimals()) | ||
token.symbol = _contract.symbol() | ||
token.name = _contract.name() | ||
token.save() | ||
} | ||
|
||
return token | ||
} |
Oops, something went wrong.