From 4cbe04eda13a1d45d234d96627b85411432ad030 Mon Sep 17 00:00:00 2001 From: Michael Kim Date: Wed, 21 Feb 2024 12:32:35 +0900 Subject: [PATCH] [SubGraph] Add and modify events --- packages/contracts-lib/package.json | 2 +- .../contracts/controllers/LoyaltyBridge.sol | 15 +- .../contracts/controllers/LoyaltyBurner.sol | 12 +- packages/contracts/package.json | 2 +- packages/faker/package.json | 2 +- packages/relay/package.json | 2 +- packages/subgraph/.gitignore | 2 + packages/subgraph/generated/Ledger/Ledger.ts | 1743 ----------------- .../LoyaltyConsumer/LoyaltyConsumer.ts | 797 -------- .../LoyaltyExchanger/LoyaltyExchanger.ts | 469 ----- .../LoyaltyProvider/LoyaltyProvider.ts | 506 ----- .../LoyaltyTransfer/LoyaltyTransfer.ts | 401 ---- packages/subgraph/generated/Shop/Shop.ts | 1308 ------------- packages/subgraph/generated/schema.ts | 1617 --------------- packages/subgraph/manifest/data/devnet.json | 10 + .../manifest/subgraph.placeholder.yaml | 48 + packages/subgraph/schema.graphql | 42 + packages/subgraph/src/ledger.ts | 635 ++++-- packages/validator/package.json | 2 +- 19 files changed, 545 insertions(+), 7070 deletions(-) delete mode 100644 packages/subgraph/generated/Ledger/Ledger.ts delete mode 100644 packages/subgraph/generated/LoyaltyConsumer/LoyaltyConsumer.ts delete mode 100644 packages/subgraph/generated/LoyaltyExchanger/LoyaltyExchanger.ts delete mode 100644 packages/subgraph/generated/LoyaltyProvider/LoyaltyProvider.ts delete mode 100644 packages/subgraph/generated/LoyaltyTransfer/LoyaltyTransfer.ts delete mode 100644 packages/subgraph/generated/Shop/Shop.ts delete mode 100644 packages/subgraph/generated/schema.ts diff --git a/packages/contracts-lib/package.json b/packages/contracts-lib/package.json index 6b7cd3de..f0c049c1 100644 --- a/packages/contracts-lib/package.json +++ b/packages/contracts-lib/package.json @@ -1,6 +1,6 @@ { "name": "dms-osx-lib", - "version": "2.7.3", + "version": "2.7.5", "description": "", "main": "dist/bundle-cjs.js", "module": "dist/bundle-esm.js", diff --git a/packages/contracts/contracts/controllers/LoyaltyBridge.sol b/packages/contracts/contracts/controllers/LoyaltyBridge.sol index b38e15d1..74583761 100644 --- a/packages/contracts/contracts/controllers/LoyaltyBridge.sol +++ b/packages/contracts/contracts/controllers/LoyaltyBridge.sol @@ -16,8 +16,8 @@ import "../interfaces/ILedger.sol"; import "./LoyaltyBridgeStorage.sol"; contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeable, UUPSUpgradeable, IBridge { - event BridgeDeposited(bytes32 depositId, address account, uint256 amount); - event BridgeWithdrawn(bytes32 withdrawId, address account, uint256 amount); + event BridgeDeposited(bytes32 depositId, address account, uint256 amount, uint256 balance); + event BridgeWithdrawn(bytes32 withdrawId, address account, uint256 amount, uint256 balance); function initialize(address _validatorAddress) external initializer { __UUPSUpgradeable_init(); @@ -97,7 +97,7 @@ contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeabl DepositData memory data = DepositData({ account: _account, amount: _amount }); deposits[_depositId] = data; - emit BridgeDeposited(_depositId, _account, _amount); + emit BridgeDeposited(_depositId, _account, _amount, ledgerContract.tokenBalanceOf(_account)); } /// @notice 브리지에서 자금을 인출합니다. 검증자들의 합의가 완료되면 인출이 됩니다. @@ -124,7 +124,7 @@ contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeabl ledgerContract.transferToken(address(this), _account, withdrawalAmount); ledgerContract.transferToken(address(this), feeAccount, fee); withdraws[_withdrawId].executed = true; - emit BridgeWithdrawn(_withdrawId, _account, withdrawalAmount); + emit BridgeWithdrawn(_withdrawId, _account, withdrawalAmount, ledgerContract.tokenBalanceOf(_account)); } } } @@ -139,7 +139,12 @@ contract LoyaltyBridge is LoyaltyBridgeStorage, Initializable, OwnableUpgradeabl ledgerContract.transferToken(address(this), withdraws[_withdrawId].account, withdrawalAmount); ledgerContract.transferToken(address(this), feeAccount, fee); withdraws[_withdrawId].executed = true; - emit BridgeWithdrawn(_withdrawId, withdraws[_withdrawId].account, withdrawalAmount); + emit BridgeWithdrawn( + _withdrawId, + withdraws[_withdrawId].account, + withdrawalAmount, + ledgerContract.tokenBalanceOf(withdraws[_withdrawId].account) + ); } } } diff --git a/packages/contracts/contracts/controllers/LoyaltyBurner.sol b/packages/contracts/contracts/controllers/LoyaltyBurner.sol index 2d1e5cf8..05e7d171 100644 --- a/packages/contracts/contracts/controllers/LoyaltyBurner.sol +++ b/packages/contracts/contracts/controllers/LoyaltyBurner.sol @@ -26,8 +26,8 @@ contract LoyaltyBurner is LoyaltyBurnerStorage, Initializable, OwnableUpgradeabl uint256 amount; } - event BurnedUnPayablePoint(bytes32 phone, uint256 amount); - event BurnedPoint(address account, uint256 amount); + event BurnedUnPayablePoint(bytes32 phone, uint256 amount, uint256 balance); + event BurnedPoint(address account, uint256 amount, uint256 balance); function initialize(address _validatorAddress, address _linkAddress) external initializer { __UUPSUpgradeable_init(); @@ -111,7 +111,11 @@ contract LoyaltyBurner is LoyaltyBurnerStorage, Initializable, OwnableUpgradeabl } if (burnAmount > 0) { ledgerContract.burnUnPayablePoint(data.phone, burnAmount); - emit BurnedUnPayablePoint(data.phone, burnAmount); + emit BurnedUnPayablePoint( + data.phone, + burnAmount, + ledgerContract.unPayablePointBalanceOf(data.phone) + ); } } else if (data.pointType == 1) { uint256 balance = ledgerContract.pointBalanceOf(data.account); @@ -125,7 +129,7 @@ contract LoyaltyBurner is LoyaltyBurnerStorage, Initializable, OwnableUpgradeabl } if (burnAmount > 0) { ledgerContract.burnPoint(data.account, burnAmount); - emit BurnedPoint(data.account, burnAmount); + emit BurnedPoint(data.account, burnAmount, ledgerContract.pointBalanceOf(data.account)); } } } diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 69e73c7e..00dea442 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "dms-osx-artifacts", - "version": "2.7.3", + "version": "2.7.5", "description": "Smart contracts that decentralized point systems", "files": [ "**/*.sol" diff --git a/packages/faker/package.json b/packages/faker/package.json index 650eefaa..9cc0ddcf 100644 --- a/packages/faker/package.json +++ b/packages/faker/package.json @@ -52,7 +52,7 @@ "axios": "^1.6.7", "chai": "^4.3.7", "del-osx-artifacts": "^2.2.0", - "dms-osx-artifacts": "^2.7.3", + "dms-osx-artifacts": "^2.7.5", "dotenv": "^10.0.0", "ethereum-waffle": "^4.0.10", "ethers": "npm:boa-ethers2@^5.7.9", diff --git a/packages/relay/package.json b/packages/relay/package.json index 6b4c9c8f..34b96fa9 100644 --- a/packages/relay/package.json +++ b/packages/relay/package.json @@ -69,7 +69,7 @@ "chai-http": "^4.3.7", "cors": "^2.8.5", "del-osx-artifacts": "^2.2.0", - "dms-osx-artifacts": "^2.7.3", + "dms-osx-artifacts": "^2.7.5", "dotenv": "^10.0.0", "ethereum-waffle": "^4.0.10", "ethereumjs-util": "^7.1.5", diff --git a/packages/subgraph/.gitignore b/packages/subgraph/.gitignore index 74a16f99..3155d04c 100644 --- a/packages/subgraph/.gitignore +++ b/packages/subgraph/.gitignore @@ -1 +1,3 @@ subgraph.yaml +generated/ +build/ diff --git a/packages/subgraph/generated/Ledger/Ledger.ts b/packages/subgraph/generated/Ledger/Ledger.ts deleted file mode 100644 index 3c292ad3..00000000 --- a/packages/subgraph/generated/Ledger/Ledger.ts +++ /dev/null @@ -1,1743 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class AdminChanged extends ethereum.Event { - get params(): AdminChanged__Params { - return new AdminChanged__Params(this); - } -} - -export class AdminChanged__Params { - _event: AdminChanged; - - constructor(event: AdminChanged) { - this._event = event; - } - - get previousAdmin(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newAdmin(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class BeaconUpgraded extends ethereum.Event { - get params(): BeaconUpgraded__Params { - return new BeaconUpgraded__Params(this); - } -} - -export class BeaconUpgraded__Params { - _event: BeaconUpgraded; - - constructor(event: BeaconUpgraded) { - this._event = event; - } - - get beacon(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class Deposited extends ethereum.Event { - get params(): Deposited__Params { - return new Deposited__Params(this); - } -} - -export class Deposited__Params { - _event: Deposited; - - constructor(event: Deposited) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get depositedToken(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get depositedValue(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get balanceToken(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } -} - -export class DepositedLiquidity extends ethereum.Event { - get params(): DepositedLiquidity__Params { - return new DepositedLiquidity__Params(this); - } -} - -export class DepositedLiquidity__Params { - _event: DepositedLiquidity; - - constructor(event: DepositedLiquidity) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get amount(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get liquidity(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } -} - -export class Initialized extends ethereum.Event { - get params(): Initialized__Params { - return new Initialized__Params(this); - } -} - -export class Initialized__Params { - _event: Initialized; - - constructor(event: Initialized) { - this._event = event; - } - - get version(): i32 { - return this._event.parameters[0].value.toI32(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class ProvidedPoint extends ethereum.Event { - get params(): ProvidedPoint__Params { - return new ProvidedPoint__Params(this); - } -} - -export class ProvidedPoint__Params { - _event: ProvidedPoint; - - constructor(event: ProvidedPoint) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get providedPoint(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get providedValue(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get balancePoint(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } - - get purchaseId(): string { - return this._event.parameters[5].value.toString(); - } - - get shopId(): Bytes { - return this._event.parameters[6].value.toBytes(); - } -} - -export class ProvidedToken extends ethereum.Event { - get params(): ProvidedToken__Params { - return new ProvidedToken__Params(this); - } -} - -export class ProvidedToken__Params { - _event: ProvidedToken; - - constructor(event: ProvidedToken) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get providedToken(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get providedValue(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get balanceToken(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } - - get purchaseId(): string { - return this._event.parameters[5].value.toString(); - } - - get shopId(): Bytes { - return this._event.parameters[6].value.toBytes(); - } -} - -export class ProvidedUnPayablePoint extends ethereum.Event { - get params(): ProvidedUnPayablePoint__Params { - return new ProvidedUnPayablePoint__Params(this); - } -} - -export class ProvidedUnPayablePoint__Params { - _event: ProvidedUnPayablePoint; - - constructor(event: ProvidedUnPayablePoint) { - this._event = event; - } - - get phone(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get providedPoint(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get providedValue(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get balancePoint(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } - - get purchaseId(): string { - return this._event.parameters[5].value.toString(); - } - - get shopId(): Bytes { - return this._event.parameters[6].value.toBytes(); - } -} - -export class RemovedPhoneInfo extends ethereum.Event { - get params(): RemovedPhoneInfo__Params { - return new RemovedPhoneInfo__Params(this); - } -} - -export class RemovedPhoneInfo__Params { - _event: RemovedPhoneInfo; - - constructor(event: RemovedPhoneInfo) { - this._event = event; - } - - get phone(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get account(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class Upgraded extends ethereum.Event { - get params(): Upgraded__Params { - return new Upgraded__Params(this); - } -} - -export class Upgraded__Params { - _event: Upgraded; - - constructor(event: Upgraded) { - this._event = event; - } - - get implementation(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class Withdrawn extends ethereum.Event { - get params(): Withdrawn__Params { - return new Withdrawn__Params(this); - } -} - -export class Withdrawn__Params { - _event: Withdrawn; - - constructor(event: Withdrawn) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get withdrawnToken(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get withdrawnValue(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get balanceToken(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } -} - -export class WithdrawnLiquidity extends ethereum.Event { - get params(): WithdrawnLiquidity__Params { - return new WithdrawnLiquidity__Params(this); - } -} - -export class WithdrawnLiquidity__Params { - _event: WithdrawnLiquidity; - - constructor(event: WithdrawnLiquidity) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get amount(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get liquidity(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } -} - -export class Ledger extends ethereum.SmartContract { - static bind(address: Address): Ledger { - return new Ledger("Ledger", address); - } - - MAX_FEE(): BigInt { - let result = super.call("MAX_FEE", "MAX_FEE():(uint32)", []); - - return result[0].toBigInt(); - } - - try_MAX_FEE(): ethereum.CallResult { - let result = super.tryCall("MAX_FEE", "MAX_FEE():(uint32)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - bridgeAddress(): Address { - let result = super.call("bridgeAddress", "bridgeAddress():(address)", []); - - return result[0].toAddress(); - } - - try_bridgeAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "bridgeAddress", - "bridgeAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - burnerAddress(): Address { - let result = super.call("burnerAddress", "burnerAddress():(address)", []); - - return result[0].toAddress(); - } - - try_burnerAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "burnerAddress", - "burnerAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - consumerAddress(): Address { - let result = super.call( - "consumerAddress", - "consumerAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_consumerAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "consumerAddress", - "consumerAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - exchangerAddress(): Address { - let result = super.call( - "exchangerAddress", - "exchangerAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_exchangerAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "exchangerAddress", - "exchangerAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - feeAccount(): Address { - let result = super.call("feeAccount", "feeAccount():(address)", []); - - return result[0].toAddress(); - } - - try_feeAccount(): ethereum.CallResult
{ - let result = super.tryCall("feeAccount", "feeAccount():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - foundationAccount(): Address { - let result = super.call( - "foundationAccount", - "foundationAccount():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_foundationAccount(): ethereum.CallResult
{ - let result = super.tryCall( - "foundationAccount", - "foundationAccount():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - getFee(): BigInt { - let result = super.call("getFee", "getFee():(uint32)", []); - - return result[0].toBigInt(); - } - - try_getFee(): ethereum.CallResult { - let result = super.tryCall("getFee", "getFee():(uint32)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - getFeeAccount(): Address { - let result = super.call("getFeeAccount", "getFeeAccount():(address)", []); - - return result[0].toAddress(); - } - - try_getFeeAccount(): ethereum.CallResult
{ - let result = super.tryCall( - "getFeeAccount", - "getFeeAccount():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - getFoundationAccount(): Address { - let result = super.call( - "getFoundationAccount", - "getFoundationAccount():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_getFoundationAccount(): ethereum.CallResult
{ - let result = super.tryCall( - "getFoundationAccount", - "getFoundationAccount():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - getLiquidity(_account: Address): BigInt { - let result = super.call("getLiquidity", "getLiquidity(address):(uint256)", [ - ethereum.Value.fromAddress(_account) - ]); - - return result[0].toBigInt(); - } - - try_getLiquidity(_account: Address): ethereum.CallResult { - let result = super.tryCall( - "getLiquidity", - "getLiquidity(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - getSettlementAccount(): Address { - let result = super.call( - "getSettlementAccount", - "getSettlementAccount():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_getSettlementAccount(): ethereum.CallResult
{ - let result = super.tryCall( - "getSettlementAccount", - "getSettlementAccount():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - getTokenAddress(): Address { - let result = super.call( - "getTokenAddress", - "getTokenAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_getTokenAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "getTokenAddress", - "getTokenAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - loyaltyTypeOf(_account: Address): i32 { - let result = super.call("loyaltyTypeOf", "loyaltyTypeOf(address):(uint8)", [ - ethereum.Value.fromAddress(_account) - ]); - - return result[0].toI32(); - } - - try_loyaltyTypeOf(_account: Address): ethereum.CallResult { - let result = super.tryCall( - "loyaltyTypeOf", - "loyaltyTypeOf(address):(uint8)", - [ethereum.Value.fromAddress(_account)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toI32()); - } - - nonceOf(_account: Address): BigInt { - let result = super.call("nonceOf", "nonceOf(address):(uint256)", [ - ethereum.Value.fromAddress(_account) - ]); - - return result[0].toBigInt(); - } - - try_nonceOf(_account: Address): ethereum.CallResult { - let result = super.tryCall("nonceOf", "nonceOf(address):(uint256)", [ - ethereum.Value.fromAddress(_account) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - pointBalanceOf(_account: Address): BigInt { - let result = super.call( - "pointBalanceOf", - "pointBalanceOf(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - - return result[0].toBigInt(); - } - - try_pointBalanceOf(_account: Address): ethereum.CallResult { - let result = super.tryCall( - "pointBalanceOf", - "pointBalanceOf(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - providerAddress(): Address { - let result = super.call( - "providerAddress", - "providerAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_providerAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "providerAddress", - "providerAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - proxiableUUID(): Bytes { - let result = super.call("proxiableUUID", "proxiableUUID():(bytes32)", []); - - return result[0].toBytes(); - } - - try_proxiableUUID(): ethereum.CallResult { - let result = super.tryCall( - "proxiableUUID", - "proxiableUUID():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } - - settlementAccount(): Address { - let result = super.call( - "settlementAccount", - "settlementAccount():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_settlementAccount(): ethereum.CallResult
{ - let result = super.tryCall( - "settlementAccount", - "settlementAccount():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - tokenAddress(): Address { - let result = super.call("tokenAddress", "tokenAddress():(address)", []); - - return result[0].toAddress(); - } - - try_tokenAddress(): ethereum.CallResult
{ - let result = super.tryCall("tokenAddress", "tokenAddress():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - tokenBalanceOf(_account: Address): BigInt { - let result = super.call( - "tokenBalanceOf", - "tokenBalanceOf(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - - return result[0].toBigInt(); - } - - try_tokenBalanceOf(_account: Address): ethereum.CallResult { - let result = super.tryCall( - "tokenBalanceOf", - "tokenBalanceOf(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - transferAddress(): Address { - let result = super.call( - "transferAddress", - "transferAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_transferAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "transferAddress", - "transferAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - unPayablePointBalanceOf(_phone: Bytes): BigInt { - let result = super.call( - "unPayablePointBalanceOf", - "unPayablePointBalanceOf(bytes32):(uint256)", - [ethereum.Value.fromFixedBytes(_phone)] - ); - - return result[0].toBigInt(); - } - - try_unPayablePointBalanceOf(_phone: Bytes): ethereum.CallResult { - let result = super.tryCall( - "unPayablePointBalanceOf", - "unPayablePointBalanceOf(bytes32):(uint256)", - [ethereum.Value.fromFixedBytes(_phone)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } -} - -export class AddPointBalanceCall extends ethereum.Call { - get inputs(): AddPointBalanceCall__Inputs { - return new AddPointBalanceCall__Inputs(this); - } - - get outputs(): AddPointBalanceCall__Outputs { - return new AddPointBalanceCall__Outputs(this); - } -} - -export class AddPointBalanceCall__Inputs { - _call: AddPointBalanceCall; - - constructor(call: AddPointBalanceCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class AddPointBalanceCall__Outputs { - _call: AddPointBalanceCall; - - constructor(call: AddPointBalanceCall) { - this._call = call; - } -} - -export class AddTokenBalanceCall extends ethereum.Call { - get inputs(): AddTokenBalanceCall__Inputs { - return new AddTokenBalanceCall__Inputs(this); - } - - get outputs(): AddTokenBalanceCall__Outputs { - return new AddTokenBalanceCall__Outputs(this); - } -} - -export class AddTokenBalanceCall__Inputs { - _call: AddTokenBalanceCall; - - constructor(call: AddTokenBalanceCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class AddTokenBalanceCall__Outputs { - _call: AddTokenBalanceCall; - - constructor(call: AddTokenBalanceCall) { - this._call = call; - } -} - -export class BurnPointCall extends ethereum.Call { - get inputs(): BurnPointCall__Inputs { - return new BurnPointCall__Inputs(this); - } - - get outputs(): BurnPointCall__Outputs { - return new BurnPointCall__Outputs(this); - } -} - -export class BurnPointCall__Inputs { - _call: BurnPointCall; - - constructor(call: BurnPointCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class BurnPointCall__Outputs { - _call: BurnPointCall; - - constructor(call: BurnPointCall) { - this._call = call; - } -} - -export class BurnUnPayablePointCall extends ethereum.Call { - get inputs(): BurnUnPayablePointCall__Inputs { - return new BurnUnPayablePointCall__Inputs(this); - } - - get outputs(): BurnUnPayablePointCall__Outputs { - return new BurnUnPayablePointCall__Outputs(this); - } -} - -export class BurnUnPayablePointCall__Inputs { - _call: BurnUnPayablePointCall; - - constructor(call: BurnUnPayablePointCall) { - this._call = call; - } - - get _phone(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class BurnUnPayablePointCall__Outputs { - _call: BurnUnPayablePointCall; - - constructor(call: BurnUnPayablePointCall) { - this._call = call; - } -} - -export class ChangeToLoyaltyTokenCall extends ethereum.Call { - get inputs(): ChangeToLoyaltyTokenCall__Inputs { - return new ChangeToLoyaltyTokenCall__Inputs(this); - } - - get outputs(): ChangeToLoyaltyTokenCall__Outputs { - return new ChangeToLoyaltyTokenCall__Outputs(this); - } -} - -export class ChangeToLoyaltyTokenCall__Inputs { - _call: ChangeToLoyaltyTokenCall; - - constructor(call: ChangeToLoyaltyTokenCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class ChangeToLoyaltyTokenCall__Outputs { - _call: ChangeToLoyaltyTokenCall; - - constructor(call: ChangeToLoyaltyTokenCall) { - this._call = call; - } -} - -export class ChangeToPayablePointCall extends ethereum.Call { - get inputs(): ChangeToPayablePointCall__Inputs { - return new ChangeToPayablePointCall__Inputs(this); - } - - get outputs(): ChangeToPayablePointCall__Outputs { - return new ChangeToPayablePointCall__Outputs(this); - } -} - -export class ChangeToPayablePointCall__Inputs { - _call: ChangeToPayablePointCall; - - constructor(call: ChangeToPayablePointCall) { - this._call = call; - } - - get _phone(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _account(): Address { - return this._call.inputValues[1].value.toAddress(); - } -} - -export class ChangeToPayablePointCall__Outputs { - _call: ChangeToPayablePointCall; - - constructor(call: ChangeToPayablePointCall) { - this._call = call; - } -} - -export class DepositCall extends ethereum.Call { - get inputs(): DepositCall__Inputs { - return new DepositCall__Inputs(this); - } - - get outputs(): DepositCall__Outputs { - return new DepositCall__Outputs(this); - } -} - -export class DepositCall__Inputs { - _call: DepositCall; - - constructor(call: DepositCall) { - this._call = call; - } - - get _amount(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } -} - -export class DepositCall__Outputs { - _call: DepositCall; - - constructor(call: DepositCall) { - this._call = call; - } -} - -export class DepositLiquidityCall extends ethereum.Call { - get inputs(): DepositLiquidityCall__Inputs { - return new DepositLiquidityCall__Inputs(this); - } - - get outputs(): DepositLiquidityCall__Outputs { - return new DepositLiquidityCall__Outputs(this); - } -} - -export class DepositLiquidityCall__Inputs { - _call: DepositLiquidityCall; - - constructor(call: DepositLiquidityCall) { - this._call = call; - } - - get _amount(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _signature(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class DepositLiquidityCall__Outputs { - _call: DepositLiquidityCall; - - constructor(call: DepositLiquidityCall) { - this._call = call; - } -} - -export class IncreaseNonceCall extends ethereum.Call { - get inputs(): IncreaseNonceCall__Inputs { - return new IncreaseNonceCall__Inputs(this); - } - - get outputs(): IncreaseNonceCall__Outputs { - return new IncreaseNonceCall__Outputs(this); - } -} - -export class IncreaseNonceCall__Inputs { - _call: IncreaseNonceCall; - - constructor(call: IncreaseNonceCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class IncreaseNonceCall__Outputs { - _call: IncreaseNonceCall; - - constructor(call: IncreaseNonceCall) { - this._call = call; - } -} - -export class InitializeCall extends ethereum.Call { - get inputs(): InitializeCall__Inputs { - return new InitializeCall__Inputs(this); - } - - get outputs(): InitializeCall__Outputs { - return new InitializeCall__Outputs(this); - } -} - -export class InitializeCall__Inputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } - - get _foundationAccount(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _settlementAccount(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _feeAccount(): Address { - return this._call.inputValues[2].value.toAddress(); - } - - get _tokenAddress(): Address { - return this._call.inputValues[3].value.toAddress(); - } - - get _linkAddress(): Address { - return this._call.inputValues[4].value.toAddress(); - } - - get _currencyRateAddress(): Address { - return this._call.inputValues[5].value.toAddress(); - } - - get _providerAddress(): Address { - return this._call.inputValues[6].value.toAddress(); - } - - get _consumerAddress(): Address { - return this._call.inputValues[7].value.toAddress(); - } - - get _exchangerAddress(): Address { - return this._call.inputValues[8].value.toAddress(); - } - - get _burnerAddress(): Address { - return this._call.inputValues[9].value.toAddress(); - } - - get _transferAddress(): Address { - return this._call.inputValues[10].value.toAddress(); - } - - get _bridgeAddress(): Address { - return this._call.inputValues[11].value.toAddress(); - } -} - -export class InitializeCall__Outputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class ProvidePointCall extends ethereum.Call { - get inputs(): ProvidePointCall__Inputs { - return new ProvidePointCall__Inputs(this); - } - - get outputs(): ProvidePointCall__Outputs { - return new ProvidePointCall__Outputs(this); - } -} - -export class ProvidePointCall__Inputs { - _call: ProvidePointCall; - - constructor(call: ProvidePointCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _loyaltyPoint(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _loyaltyValue(): BigInt { - return this._call.inputValues[2].value.toBigInt(); - } - - get _currency(): string { - return this._call.inputValues[3].value.toString(); - } - - get _purchaseId(): string { - return this._call.inputValues[4].value.toString(); - } - - get _shopId(): Bytes { - return this._call.inputValues[5].value.toBytes(); - } - - get _sender(): Address { - return this._call.inputValues[6].value.toAddress(); - } -} - -export class ProvidePointCall__Outputs { - _call: ProvidePointCall; - - constructor(call: ProvidePointCall) { - this._call = call; - } -} - -export class ProvideTokenCall extends ethereum.Call { - get inputs(): ProvideTokenCall__Inputs { - return new ProvideTokenCall__Inputs(this); - } - - get outputs(): ProvideTokenCall__Outputs { - return new ProvideTokenCall__Outputs(this); - } -} - -export class ProvideTokenCall__Inputs { - _call: ProvideTokenCall; - - constructor(call: ProvideTokenCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _loyaltyPoint(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _loyaltyValue(): BigInt { - return this._call.inputValues[2].value.toBigInt(); - } - - get _currency(): string { - return this._call.inputValues[3].value.toString(); - } - - get _purchaseId(): string { - return this._call.inputValues[4].value.toString(); - } - - get _shopId(): Bytes { - return this._call.inputValues[5].value.toBytes(); - } - - get _sender(): Address { - return this._call.inputValues[6].value.toAddress(); - } -} - -export class ProvideTokenCall__Outputs { - _call: ProvideTokenCall; - - constructor(call: ProvideTokenCall) { - this._call = call; - } -} - -export class ProvideUnPayablePointCall extends ethereum.Call { - get inputs(): ProvideUnPayablePointCall__Inputs { - return new ProvideUnPayablePointCall__Inputs(this); - } - - get outputs(): ProvideUnPayablePointCall__Outputs { - return new ProvideUnPayablePointCall__Outputs(this); - } -} - -export class ProvideUnPayablePointCall__Inputs { - _call: ProvideUnPayablePointCall; - - constructor(call: ProvideUnPayablePointCall) { - this._call = call; - } - - get _phone(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _loyaltyPoint(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _loyaltyValue(): BigInt { - return this._call.inputValues[2].value.toBigInt(); - } - - get _currency(): string { - return this._call.inputValues[3].value.toString(); - } - - get _purchaseId(): string { - return this._call.inputValues[4].value.toString(); - } - - get _shopId(): Bytes { - return this._call.inputValues[5].value.toBytes(); - } - - get _sender(): Address { - return this._call.inputValues[6].value.toAddress(); - } -} - -export class ProvideUnPayablePointCall__Outputs { - _call: ProvideUnPayablePointCall; - - constructor(call: ProvideUnPayablePointCall) { - this._call = call; - } -} - -export class RemovePhoneInfoCall extends ethereum.Call { - get inputs(): RemovePhoneInfoCall__Inputs { - return new RemovePhoneInfoCall__Inputs(this); - } - - get outputs(): RemovePhoneInfoCall__Outputs { - return new RemovePhoneInfoCall__Outputs(this); - } -} - -export class RemovePhoneInfoCall__Inputs { - _call: RemovePhoneInfoCall; - - constructor(call: RemovePhoneInfoCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class RemovePhoneInfoCall__Outputs { - _call: RemovePhoneInfoCall; - - constructor(call: RemovePhoneInfoCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SetFeeCall extends ethereum.Call { - get inputs(): SetFeeCall__Inputs { - return new SetFeeCall__Inputs(this); - } - - get outputs(): SetFeeCall__Outputs { - return new SetFeeCall__Outputs(this); - } -} - -export class SetFeeCall__Inputs { - _call: SetFeeCall; - - constructor(call: SetFeeCall) { - this._call = call; - } - - get _fee(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } -} - -export class SetFeeCall__Outputs { - _call: SetFeeCall; - - constructor(call: SetFeeCall) { - this._call = call; - } -} - -export class SubPointBalanceCall extends ethereum.Call { - get inputs(): SubPointBalanceCall__Inputs { - return new SubPointBalanceCall__Inputs(this); - } - - get outputs(): SubPointBalanceCall__Outputs { - return new SubPointBalanceCall__Outputs(this); - } -} - -export class SubPointBalanceCall__Inputs { - _call: SubPointBalanceCall; - - constructor(call: SubPointBalanceCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class SubPointBalanceCall__Outputs { - _call: SubPointBalanceCall; - - constructor(call: SubPointBalanceCall) { - this._call = call; - } -} - -export class SubTokenBalanceCall extends ethereum.Call { - get inputs(): SubTokenBalanceCall__Inputs { - return new SubTokenBalanceCall__Inputs(this); - } - - get outputs(): SubTokenBalanceCall__Outputs { - return new SubTokenBalanceCall__Outputs(this); - } -} - -export class SubTokenBalanceCall__Inputs { - _call: SubTokenBalanceCall; - - constructor(call: SubTokenBalanceCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } -} - -export class SubTokenBalanceCall__Outputs { - _call: SubTokenBalanceCall; - - constructor(call: SubTokenBalanceCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} - -export class TransferTokenCall extends ethereum.Call { - get inputs(): TransferTokenCall__Inputs { - return new TransferTokenCall__Inputs(this); - } - - get outputs(): TransferTokenCall__Outputs { - return new TransferTokenCall__Outputs(this); - } -} - -export class TransferTokenCall__Inputs { - _call: TransferTokenCall; - - constructor(call: TransferTokenCall) { - this._call = call; - } - - get _from(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _to(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[2].value.toBigInt(); - } -} - -export class TransferTokenCall__Outputs { - _call: TransferTokenCall; - - constructor(call: TransferTokenCall) { - this._call = call; - } -} - -export class UpgradeToCall extends ethereum.Call { - get inputs(): UpgradeToCall__Inputs { - return new UpgradeToCall__Inputs(this); - } - - get outputs(): UpgradeToCall__Outputs { - return new UpgradeToCall__Outputs(this); - } -} - -export class UpgradeToCall__Inputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class UpgradeToCall__Outputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } -} - -export class UpgradeToAndCallCall extends ethereum.Call { - get inputs(): UpgradeToAndCallCall__Inputs { - return new UpgradeToAndCallCall__Inputs(this); - } - - get outputs(): UpgradeToAndCallCall__Outputs { - return new UpgradeToAndCallCall__Outputs(this); - } -} - -export class UpgradeToAndCallCall__Inputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get data(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class UpgradeToAndCallCall__Outputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } -} - -export class WithdrawCall extends ethereum.Call { - get inputs(): WithdrawCall__Inputs { - return new WithdrawCall__Inputs(this); - } - - get outputs(): WithdrawCall__Outputs { - return new WithdrawCall__Outputs(this); - } -} - -export class WithdrawCall__Inputs { - _call: WithdrawCall; - - constructor(call: WithdrawCall) { - this._call = call; - } - - get _amount(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } -} - -export class WithdrawCall__Outputs { - _call: WithdrawCall; - - constructor(call: WithdrawCall) { - this._call = call; - } -} - -export class WithdrawLiquidityCall extends ethereum.Call { - get inputs(): WithdrawLiquidityCall__Inputs { - return new WithdrawLiquidityCall__Inputs(this); - } - - get outputs(): WithdrawLiquidityCall__Outputs { - return new WithdrawLiquidityCall__Outputs(this); - } -} - -export class WithdrawLiquidityCall__Inputs { - _call: WithdrawLiquidityCall; - - constructor(call: WithdrawLiquidityCall) { - this._call = call; - } - - get _amount(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } -} - -export class WithdrawLiquidityCall__Outputs { - _call: WithdrawLiquidityCall; - - constructor(call: WithdrawLiquidityCall) { - this._call = call; - } -} diff --git a/packages/subgraph/generated/LoyaltyConsumer/LoyaltyConsumer.ts b/packages/subgraph/generated/LoyaltyConsumer/LoyaltyConsumer.ts deleted file mode 100644 index 19282525..00000000 --- a/packages/subgraph/generated/LoyaltyConsumer/LoyaltyConsumer.ts +++ /dev/null @@ -1,797 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class AdminChanged extends ethereum.Event { - get params(): AdminChanged__Params { - return new AdminChanged__Params(this); - } -} - -export class AdminChanged__Params { - _event: AdminChanged; - - constructor(event: AdminChanged) { - this._event = event; - } - - get previousAdmin(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newAdmin(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class BeaconUpgraded extends ethereum.Event { - get params(): BeaconUpgraded__Params { - return new BeaconUpgraded__Params(this); - } -} - -export class BeaconUpgraded__Params { - _event: BeaconUpgraded; - - constructor(event: BeaconUpgraded) { - this._event = event; - } - - get beacon(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class Initialized extends ethereum.Event { - get params(): Initialized__Params { - return new Initialized__Params(this); - } -} - -export class Initialized__Params { - _event: Initialized; - - constructor(event: Initialized) { - this._event = event; - } - - get version(): i32 { - return this._event.parameters[0].value.toI32(); - } -} - -export class LoyaltyPaymentEvent extends ethereum.Event { - get params(): LoyaltyPaymentEvent__Params { - return new LoyaltyPaymentEvent__Params(this); - } -} - -export class LoyaltyPaymentEvent__Params { - _event: LoyaltyPaymentEvent; - - constructor(event: LoyaltyPaymentEvent) { - this._event = event; - } - - get payment(): LoyaltyPaymentEventPaymentStruct { - return changetype( - this._event.parameters[0].value.toTuple() - ); - } - - get balance(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } -} - -export class LoyaltyPaymentEventPaymentStruct extends ethereum.Tuple { - get paymentId(): Bytes { - return this[0].toBytes(); - } - - get purchaseId(): string { - return this[1].toString(); - } - - get currency(): string { - return this[2].toString(); - } - - get shopId(): Bytes { - return this[3].toBytes(); - } - - get account(): Address { - return this[4].toAddress(); - } - - get secretLock(): Bytes { - return this[5].toBytes(); - } - - get timestamp(): BigInt { - return this[6].toBigInt(); - } - - get loyaltyType(): i32 { - return this[7].toI32(); - } - - get paidPoint(): BigInt { - return this[8].toBigInt(); - } - - get paidToken(): BigInt { - return this[9].toBigInt(); - } - - get paidValue(): BigInt { - return this[10].toBigInt(); - } - - get feePoint(): BigInt { - return this[11].toBigInt(); - } - - get feeToken(): BigInt { - return this[12].toBigInt(); - } - - get feeValue(): BigInt { - return this[13].toBigInt(); - } - - get usedValueShop(): BigInt { - return this[14].toBigInt(); - } - - get status(): i32 { - return this[15].toI32(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class ProvidedTokenForSettlement extends ethereum.Event { - get params(): ProvidedTokenForSettlement__Params { - return new ProvidedTokenForSettlement__Params(this); - } -} - -export class ProvidedTokenForSettlement__Params { - _event: ProvidedTokenForSettlement; - - constructor(event: ProvidedTokenForSettlement) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get shopId(): Bytes { - return this._event.parameters[1].value.toBytes(); - } - - get providedPoint(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get providedToken(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } - - get providedValue(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[5].value.toString(); - } - - get balanceToken(): BigInt { - return this._event.parameters[6].value.toBigInt(); - } - - get purchaseId(): string { - return this._event.parameters[7].value.toString(); - } -} - -export class Upgraded extends ethereum.Event { - get params(): Upgraded__Params { - return new Upgraded__Params(this); - } -} - -export class Upgraded__Params { - _event: Upgraded; - - constructor(event: Upgraded) { - this._event = event; - } - - get implementation(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class LoyaltyConsumer__loyaltyPaymentOfResultValue0Struct extends ethereum.Tuple { - get paymentId(): Bytes { - return this[0].toBytes(); - } - - get purchaseId(): string { - return this[1].toString(); - } - - get currency(): string { - return this[2].toString(); - } - - get shopId(): Bytes { - return this[3].toBytes(); - } - - get account(): Address { - return this[4].toAddress(); - } - - get secretLock(): Bytes { - return this[5].toBytes(); - } - - get timestamp(): BigInt { - return this[6].toBigInt(); - } - - get loyaltyType(): i32 { - return this[7].toI32(); - } - - get paidPoint(): BigInt { - return this[8].toBigInt(); - } - - get paidToken(): BigInt { - return this[9].toBigInt(); - } - - get paidValue(): BigInt { - return this[10].toBigInt(); - } - - get feePoint(): BigInt { - return this[11].toBigInt(); - } - - get feeToken(): BigInt { - return this[12].toBigInt(); - } - - get feeValue(): BigInt { - return this[13].toBigInt(); - } - - get usedValueShop(): BigInt { - return this[14].toBigInt(); - } - - get status(): i32 { - return this[15].toI32(); - } -} - -export class LoyaltyConsumer extends ethereum.SmartContract { - static bind(address: Address): LoyaltyConsumer { - return new LoyaltyConsumer("LoyaltyConsumer", address); - } - - isAvailablePaymentId(_paymentId: Bytes): boolean { - let result = super.call( - "isAvailablePaymentId", - "isAvailablePaymentId(bytes32):(bool)", - [ethereum.Value.fromFixedBytes(_paymentId)] - ); - - return result[0].toBoolean(); - } - - try_isAvailablePaymentId(_paymentId: Bytes): ethereum.CallResult { - let result = super.tryCall( - "isAvailablePaymentId", - "isAvailablePaymentId(bytes32):(bool)", - [ethereum.Value.fromFixedBytes(_paymentId)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBoolean()); - } - - loyaltyPaymentOf( - _paymentId: Bytes - ): LoyaltyConsumer__loyaltyPaymentOfResultValue0Struct { - let result = super.call( - "loyaltyPaymentOf", - "loyaltyPaymentOf(bytes32):((bytes32,string,string,bytes32,address,bytes32,uint256,uint8,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint8))", - [ethereum.Value.fromFixedBytes(_paymentId)] - ); - - return changetype( - result[0].toTuple() - ); - } - - try_loyaltyPaymentOf( - _paymentId: Bytes - ): ethereum.CallResult { - let result = super.tryCall( - "loyaltyPaymentOf", - "loyaltyPaymentOf(bytes32):((bytes32,string,string,bytes32,address,bytes32,uint256,uint8,uint256,uint256,uint256,uint256,uint256,uint256,uint256,uint8))", - [ethereum.Value.fromFixedBytes(_paymentId)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue( - changetype( - value[0].toTuple() - ) - ); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - proxiableUUID(): Bytes { - let result = super.call("proxiableUUID", "proxiableUUID():(bytes32)", []); - - return result[0].toBytes(); - } - - try_proxiableUUID(): ethereum.CallResult { - let result = super.tryCall( - "proxiableUUID", - "proxiableUUID():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } -} - -export class CloseCancelLoyaltyPaymentCall extends ethereum.Call { - get inputs(): CloseCancelLoyaltyPaymentCall__Inputs { - return new CloseCancelLoyaltyPaymentCall__Inputs(this); - } - - get outputs(): CloseCancelLoyaltyPaymentCall__Outputs { - return new CloseCancelLoyaltyPaymentCall__Outputs(this); - } -} - -export class CloseCancelLoyaltyPaymentCall__Inputs { - _call: CloseCancelLoyaltyPaymentCall; - - constructor(call: CloseCancelLoyaltyPaymentCall) { - this._call = call; - } - - get _paymentId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _secret(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } - - get _confirm(): boolean { - return this._call.inputValues[2].value.toBoolean(); - } -} - -export class CloseCancelLoyaltyPaymentCall__Outputs { - _call: CloseCancelLoyaltyPaymentCall; - - constructor(call: CloseCancelLoyaltyPaymentCall) { - this._call = call; - } -} - -export class CloseNewLoyaltyPaymentCall extends ethereum.Call { - get inputs(): CloseNewLoyaltyPaymentCall__Inputs { - return new CloseNewLoyaltyPaymentCall__Inputs(this); - } - - get outputs(): CloseNewLoyaltyPaymentCall__Outputs { - return new CloseNewLoyaltyPaymentCall__Outputs(this); - } -} - -export class CloseNewLoyaltyPaymentCall__Inputs { - _call: CloseNewLoyaltyPaymentCall; - - constructor(call: CloseNewLoyaltyPaymentCall) { - this._call = call; - } - - get _paymentId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _secret(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } - - get _confirm(): boolean { - return this._call.inputValues[2].value.toBoolean(); - } -} - -export class CloseNewLoyaltyPaymentCall__Outputs { - _call: CloseNewLoyaltyPaymentCall; - - constructor(call: CloseNewLoyaltyPaymentCall) { - this._call = call; - } -} - -export class InitializeCall extends ethereum.Call { - get inputs(): InitializeCall__Inputs { - return new InitializeCall__Inputs(this); - } - - get outputs(): InitializeCall__Outputs { - return new InitializeCall__Outputs(this); - } -} - -export class InitializeCall__Inputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } - - get _currencyRateAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class InitializeCall__Outputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class OpenCancelLoyaltyPaymentCall extends ethereum.Call { - get inputs(): OpenCancelLoyaltyPaymentCall__Inputs { - return new OpenCancelLoyaltyPaymentCall__Inputs(this); - } - - get outputs(): OpenCancelLoyaltyPaymentCall__Outputs { - return new OpenCancelLoyaltyPaymentCall__Outputs(this); - } -} - -export class OpenCancelLoyaltyPaymentCall__Inputs { - _call: OpenCancelLoyaltyPaymentCall; - - constructor(call: OpenCancelLoyaltyPaymentCall) { - this._call = call; - } - - get _paymentId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _secretLock(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } - - get _signature(): Bytes { - return this._call.inputValues[2].value.toBytes(); - } -} - -export class OpenCancelLoyaltyPaymentCall__Outputs { - _call: OpenCancelLoyaltyPaymentCall; - - constructor(call: OpenCancelLoyaltyPaymentCall) { - this._call = call; - } -} - -export class OpenNewLoyaltyPaymentCall extends ethereum.Call { - get inputs(): OpenNewLoyaltyPaymentCall__Inputs { - return new OpenNewLoyaltyPaymentCall__Inputs(this); - } - - get outputs(): OpenNewLoyaltyPaymentCall__Outputs { - return new OpenNewLoyaltyPaymentCall__Outputs(this); - } -} - -export class OpenNewLoyaltyPaymentCall__Inputs { - _call: OpenNewLoyaltyPaymentCall; - - constructor(call: OpenNewLoyaltyPaymentCall) { - this._call = call; - } - - get data(): OpenNewLoyaltyPaymentCallDataStruct { - return changetype( - this._call.inputValues[0].value.toTuple() - ); - } -} - -export class OpenNewLoyaltyPaymentCall__Outputs { - _call: OpenNewLoyaltyPaymentCall; - - constructor(call: OpenNewLoyaltyPaymentCall) { - this._call = call; - } -} - -export class OpenNewLoyaltyPaymentCallDataStruct extends ethereum.Tuple { - get paymentId(): Bytes { - return this[0].toBytes(); - } - - get purchaseId(): string { - return this[1].toString(); - } - - get amount(): BigInt { - return this[2].toBigInt(); - } - - get currency(): string { - return this[3].toString(); - } - - get shopId(): Bytes { - return this[4].toBytes(); - } - - get account(): Address { - return this[5].toAddress(); - } - - get signature(): Bytes { - return this[6].toBytes(); - } - - get secretLock(): Bytes { - return this[7].toBytes(); - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SetLedgerCall extends ethereum.Call { - get inputs(): SetLedgerCall__Inputs { - return new SetLedgerCall__Inputs(this); - } - - get outputs(): SetLedgerCall__Outputs { - return new SetLedgerCall__Outputs(this); - } -} - -export class SetLedgerCall__Inputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } - - get _contractAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetLedgerCall__Outputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } -} - -export class SetShopCall extends ethereum.Call { - get inputs(): SetShopCall__Inputs { - return new SetShopCall__Inputs(this); - } - - get outputs(): SetShopCall__Outputs { - return new SetShopCall__Outputs(this); - } -} - -export class SetShopCall__Inputs { - _call: SetShopCall; - - constructor(call: SetShopCall) { - this._call = call; - } - - get _contractAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetShopCall__Outputs { - _call: SetShopCall; - - constructor(call: SetShopCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} - -export class UpgradeToCall extends ethereum.Call { - get inputs(): UpgradeToCall__Inputs { - return new UpgradeToCall__Inputs(this); - } - - get outputs(): UpgradeToCall__Outputs { - return new UpgradeToCall__Outputs(this); - } -} - -export class UpgradeToCall__Inputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class UpgradeToCall__Outputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } -} - -export class UpgradeToAndCallCall extends ethereum.Call { - get inputs(): UpgradeToAndCallCall__Inputs { - return new UpgradeToAndCallCall__Inputs(this); - } - - get outputs(): UpgradeToAndCallCall__Outputs { - return new UpgradeToAndCallCall__Outputs(this); - } -} - -export class UpgradeToAndCallCall__Inputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get data(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class UpgradeToAndCallCall__Outputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } -} diff --git a/packages/subgraph/generated/LoyaltyExchanger/LoyaltyExchanger.ts b/packages/subgraph/generated/LoyaltyExchanger/LoyaltyExchanger.ts deleted file mode 100644 index e9750a0e..00000000 --- a/packages/subgraph/generated/LoyaltyExchanger/LoyaltyExchanger.ts +++ /dev/null @@ -1,469 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class AdminChanged extends ethereum.Event { - get params(): AdminChanged__Params { - return new AdminChanged__Params(this); - } -} - -export class AdminChanged__Params { - _event: AdminChanged; - - constructor(event: AdminChanged) { - this._event = event; - } - - get previousAdmin(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newAdmin(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class BeaconUpgraded extends ethereum.Event { - get params(): BeaconUpgraded__Params { - return new BeaconUpgraded__Params(this); - } -} - -export class BeaconUpgraded__Params { - _event: BeaconUpgraded; - - constructor(event: BeaconUpgraded) { - this._event = event; - } - - get beacon(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class ChangedToLoyaltyToken extends ethereum.Event { - get params(): ChangedToLoyaltyToken__Params { - return new ChangedToLoyaltyToken__Params(this); - } -} - -export class ChangedToLoyaltyToken__Params { - _event: ChangedToLoyaltyToken; - - constructor(event: ChangedToLoyaltyToken) { - this._event = event; - } - - get account(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get amountToken(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get amountPoint(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get balanceToken(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } -} - -export class ChangedToPayablePoint extends ethereum.Event { - get params(): ChangedToPayablePoint__Params { - return new ChangedToPayablePoint__Params(this); - } -} - -export class ChangedToPayablePoint__Params { - _event: ChangedToPayablePoint; - - constructor(event: ChangedToPayablePoint) { - this._event = event; - } - - get phone(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get account(): Address { - return this._event.parameters[1].value.toAddress(); - } - - get changedPoint(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get changedValue(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } - - get balancePoint(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } -} - -export class Initialized extends ethereum.Event { - get params(): Initialized__Params { - return new Initialized__Params(this); - } -} - -export class Initialized__Params { - _event: Initialized; - - constructor(event: Initialized) { - this._event = event; - } - - get version(): i32 { - return this._event.parameters[0].value.toI32(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class Upgraded extends ethereum.Event { - get params(): Upgraded__Params { - return new Upgraded__Params(this); - } -} - -export class Upgraded__Params { - _event: Upgraded; - - constructor(event: Upgraded) { - this._event = event; - } - - get implementation(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class LoyaltyExchanger extends ethereum.SmartContract { - static bind(address: Address): LoyaltyExchanger { - return new LoyaltyExchanger("LoyaltyExchanger", address); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - proxiableUUID(): Bytes { - let result = super.call("proxiableUUID", "proxiableUUID():(bytes32)", []); - - return result[0].toBytes(); - } - - try_proxiableUUID(): ethereum.CallResult { - let result = super.tryCall( - "proxiableUUID", - "proxiableUUID():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } -} - -export class ChangeToLoyaltyTokenCall extends ethereum.Call { - get inputs(): ChangeToLoyaltyTokenCall__Inputs { - return new ChangeToLoyaltyTokenCall__Inputs(this); - } - - get outputs(): ChangeToLoyaltyTokenCall__Outputs { - return new ChangeToLoyaltyTokenCall__Outputs(this); - } -} - -export class ChangeToLoyaltyTokenCall__Inputs { - _call: ChangeToLoyaltyTokenCall; - - constructor(call: ChangeToLoyaltyTokenCall) { - this._call = call; - } - - get _account(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class ChangeToLoyaltyTokenCall__Outputs { - _call: ChangeToLoyaltyTokenCall; - - constructor(call: ChangeToLoyaltyTokenCall) { - this._call = call; - } -} - -export class ChangeToPayablePointCall extends ethereum.Call { - get inputs(): ChangeToPayablePointCall__Inputs { - return new ChangeToPayablePointCall__Inputs(this); - } - - get outputs(): ChangeToPayablePointCall__Outputs { - return new ChangeToPayablePointCall__Outputs(this); - } -} - -export class ChangeToPayablePointCall__Inputs { - _call: ChangeToPayablePointCall; - - constructor(call: ChangeToPayablePointCall) { - this._call = call; - } - - get _phone(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _account(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[2].value.toBytes(); - } -} - -export class ChangeToPayablePointCall__Outputs { - _call: ChangeToPayablePointCall; - - constructor(call: ChangeToPayablePointCall) { - this._call = call; - } -} - -export class InitializeCall extends ethereum.Call { - get inputs(): InitializeCall__Inputs { - return new InitializeCall__Inputs(this); - } - - get outputs(): InitializeCall__Outputs { - return new InitializeCall__Outputs(this); - } -} - -export class InitializeCall__Inputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } - - get _linkAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _currencyRateAddress(): Address { - return this._call.inputValues[1].value.toAddress(); - } -} - -export class InitializeCall__Outputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SetLedgerCall extends ethereum.Call { - get inputs(): SetLedgerCall__Inputs { - return new SetLedgerCall__Inputs(this); - } - - get outputs(): SetLedgerCall__Outputs { - return new SetLedgerCall__Outputs(this); - } -} - -export class SetLedgerCall__Inputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } - - get _contractAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetLedgerCall__Outputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} - -export class UpgradeToCall extends ethereum.Call { - get inputs(): UpgradeToCall__Inputs { - return new UpgradeToCall__Inputs(this); - } - - get outputs(): UpgradeToCall__Outputs { - return new UpgradeToCall__Outputs(this); - } -} - -export class UpgradeToCall__Inputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class UpgradeToCall__Outputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } -} - -export class UpgradeToAndCallCall extends ethereum.Call { - get inputs(): UpgradeToAndCallCall__Inputs { - return new UpgradeToAndCallCall__Inputs(this); - } - - get outputs(): UpgradeToAndCallCall__Outputs { - return new UpgradeToAndCallCall__Outputs(this); - } -} - -export class UpgradeToAndCallCall__Inputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get data(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class UpgradeToAndCallCall__Outputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } -} diff --git a/packages/subgraph/generated/LoyaltyProvider/LoyaltyProvider.ts b/packages/subgraph/generated/LoyaltyProvider/LoyaltyProvider.ts deleted file mode 100644 index 3c9dbd1c..00000000 --- a/packages/subgraph/generated/LoyaltyProvider/LoyaltyProvider.ts +++ /dev/null @@ -1,506 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class AdminChanged extends ethereum.Event { - get params(): AdminChanged__Params { - return new AdminChanged__Params(this); - } -} - -export class AdminChanged__Params { - _event: AdminChanged; - - constructor(event: AdminChanged) { - this._event = event; - } - - get previousAdmin(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newAdmin(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class BeaconUpgraded extends ethereum.Event { - get params(): BeaconUpgraded__Params { - return new BeaconUpgraded__Params(this); - } -} - -export class BeaconUpgraded__Params { - _event: BeaconUpgraded; - - constructor(event: BeaconUpgraded) { - this._event = event; - } - - get beacon(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class Initialized extends ethereum.Event { - get params(): Initialized__Params { - return new Initialized__Params(this); - } -} - -export class Initialized__Params { - _event: Initialized; - - constructor(event: Initialized) { - this._event = event; - } - - get version(): i32 { - return this._event.parameters[0].value.toI32(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class SavedPurchase extends ethereum.Event { - get params(): SavedPurchase__Params { - return new SavedPurchase__Params(this); - } -} - -export class SavedPurchase__Params { - _event: SavedPurchase; - - constructor(event: SavedPurchase) { - this._event = event; - } - - get purchaseId(): string { - return this._event.parameters[0].value.toString(); - } - - get amount(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get loyalty(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get shopId(): Bytes { - return this._event.parameters[4].value.toBytes(); - } - - get account(): Address { - return this._event.parameters[5].value.toAddress(); - } - - get phone(): Bytes { - return this._event.parameters[6].value.toBytes(); - } - - get sender(): Address { - return this._event.parameters[7].value.toAddress(); - } -} - -export class Upgraded extends ethereum.Event { - get params(): Upgraded__Params { - return new Upgraded__Params(this); - } -} - -export class Upgraded__Params { - _event: Upgraded; - - constructor(event: Upgraded) { - this._event = event; - } - - get implementation(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class LoyaltyProvider extends ethereum.SmartContract { - static bind(address: Address): LoyaltyProvider { - return new LoyaltyProvider("LoyaltyProvider", address); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - proxiableUUID(): Bytes { - let result = super.call("proxiableUUID", "proxiableUUID():(bytes32)", []); - - return result[0].toBytes(); - } - - try_proxiableUUID(): ethereum.CallResult { - let result = super.tryCall( - "proxiableUUID", - "proxiableUUID():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } - - purchasesOf(_purchaseId: string): boolean { - let result = super.call("purchasesOf", "purchasesOf(string):(bool)", [ - ethereum.Value.fromString(_purchaseId) - ]); - - return result[0].toBoolean(); - } - - try_purchasesOf(_purchaseId: string): ethereum.CallResult { - let result = super.tryCall("purchasesOf", "purchasesOf(string):(bool)", [ - ethereum.Value.fromString(_purchaseId) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBoolean()); - } -} - -export class InitializeCall extends ethereum.Call { - get inputs(): InitializeCall__Inputs { - return new InitializeCall__Inputs(this); - } - - get outputs(): InitializeCall__Outputs { - return new InitializeCall__Outputs(this); - } -} - -export class InitializeCall__Inputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } - - get _validatorAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _linkAddress(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _currencyRateAddress(): Address { - return this._call.inputValues[2].value.toAddress(); - } -} - -export class InitializeCall__Outputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SavePurchaseCall extends ethereum.Call { - get inputs(): SavePurchaseCall__Inputs { - return new SavePurchaseCall__Inputs(this); - } - - get outputs(): SavePurchaseCall__Outputs { - return new SavePurchaseCall__Outputs(this); - } -} - -export class SavePurchaseCall__Inputs { - _call: SavePurchaseCall; - - constructor(call: SavePurchaseCall) { - this._call = call; - } - - get _height(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _data(): Array { - return this._call.inputValues[1].value.toTupleArray< - SavePurchaseCall_dataStruct - >(); - } - - get _signatures(): Array { - return this._call.inputValues[2].value.toBytesArray(); - } -} - -export class SavePurchaseCall__Outputs { - _call: SavePurchaseCall; - - constructor(call: SavePurchaseCall) { - this._call = call; - } -} - -export class SavePurchaseCall_dataStruct extends ethereum.Tuple { - get purchaseId(): string { - return this[0].toString(); - } - - get amount(): BigInt { - return this[1].toBigInt(); - } - - get loyalty(): BigInt { - return this[2].toBigInt(); - } - - get currency(): string { - return this[3].toString(); - } - - get shopId(): Bytes { - return this[4].toBytes(); - } - - get account(): Address { - return this[5].toAddress(); - } - - get phone(): Bytes { - return this[6].toBytes(); - } - - get sender(): Address { - return this[7].toAddress(); - } -} - -export class SetLedgerCall extends ethereum.Call { - get inputs(): SetLedgerCall__Inputs { - return new SetLedgerCall__Inputs(this); - } - - get outputs(): SetLedgerCall__Outputs { - return new SetLedgerCall__Outputs(this); - } -} - -export class SetLedgerCall__Inputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } - - get _contractAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetLedgerCall__Outputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } -} - -export class SetShopCall extends ethereum.Call { - get inputs(): SetShopCall__Inputs { - return new SetShopCall__Inputs(this); - } - - get outputs(): SetShopCall__Outputs { - return new SetShopCall__Outputs(this); - } -} - -export class SetShopCall__Inputs { - _call: SetShopCall; - - constructor(call: SetShopCall) { - this._call = call; - } - - get _contractAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetShopCall__Outputs { - _call: SetShopCall; - - constructor(call: SetShopCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} - -export class UpgradeToCall extends ethereum.Call { - get inputs(): UpgradeToCall__Inputs { - return new UpgradeToCall__Inputs(this); - } - - get outputs(): UpgradeToCall__Outputs { - return new UpgradeToCall__Outputs(this); - } -} - -export class UpgradeToCall__Inputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class UpgradeToCall__Outputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } -} - -export class UpgradeToAndCallCall extends ethereum.Call { - get inputs(): UpgradeToAndCallCall__Inputs { - return new UpgradeToAndCallCall__Inputs(this); - } - - get outputs(): UpgradeToAndCallCall__Outputs { - return new UpgradeToAndCallCall__Outputs(this); - } -} - -export class UpgradeToAndCallCall__Inputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get data(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class UpgradeToAndCallCall__Outputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } -} diff --git a/packages/subgraph/generated/LoyaltyTransfer/LoyaltyTransfer.ts b/packages/subgraph/generated/LoyaltyTransfer/LoyaltyTransfer.ts deleted file mode 100644 index a36557b3..00000000 --- a/packages/subgraph/generated/LoyaltyTransfer/LoyaltyTransfer.ts +++ /dev/null @@ -1,401 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class AdminChanged extends ethereum.Event { - get params(): AdminChanged__Params { - return new AdminChanged__Params(this); - } -} - -export class AdminChanged__Params { - _event: AdminChanged; - - constructor(event: AdminChanged) { - this._event = event; - } - - get previousAdmin(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newAdmin(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class BeaconUpgraded extends ethereum.Event { - get params(): BeaconUpgraded__Params { - return new BeaconUpgraded__Params(this); - } -} - -export class BeaconUpgraded__Params { - _event: BeaconUpgraded; - - constructor(event: BeaconUpgraded) { - this._event = event; - } - - get beacon(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class Initialized extends ethereum.Event { - get params(): Initialized__Params { - return new Initialized__Params(this); - } -} - -export class Initialized__Params { - _event: Initialized; - - constructor(event: Initialized) { - this._event = event; - } - - get version(): i32 { - return this._event.parameters[0].value.toI32(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class TransferredLoyaltyToken extends ethereum.Event { - get params(): TransferredLoyaltyToken__Params { - return new TransferredLoyaltyToken__Params(this); - } -} - -export class TransferredLoyaltyToken__Params { - _event: TransferredLoyaltyToken; - - constructor(event: TransferredLoyaltyToken) { - this._event = event; - } - - get from(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get to(): Address { - return this._event.parameters[1].value.toAddress(); - } - - get amount(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get balanceOfFrom(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } - - get balanceOfTo(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } -} - -export class Upgraded extends ethereum.Event { - get params(): Upgraded__Params { - return new Upgraded__Params(this); - } -} - -export class Upgraded__Params { - _event: Upgraded; - - constructor(event: Upgraded) { - this._event = event; - } - - get implementation(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class LoyaltyTransfer extends ethereum.SmartContract { - static bind(address: Address): LoyaltyTransfer { - return new LoyaltyTransfer("LoyaltyTransfer", address); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - proxiableUUID(): Bytes { - let result = super.call("proxiableUUID", "proxiableUUID():(bytes32)", []); - - return result[0].toBytes(); - } - - try_proxiableUUID(): ethereum.CallResult { - let result = super.tryCall( - "proxiableUUID", - "proxiableUUID():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } -} - -export class InitializeCall extends ethereum.Call { - get inputs(): InitializeCall__Inputs { - return new InitializeCall__Inputs(this); - } - - get outputs(): InitializeCall__Outputs { - return new InitializeCall__Outputs(this); - } -} - -export class InitializeCall__Inputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class InitializeCall__Outputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SetLedgerCall extends ethereum.Call { - get inputs(): SetLedgerCall__Inputs { - return new SetLedgerCall__Inputs(this); - } - - get outputs(): SetLedgerCall__Outputs { - return new SetLedgerCall__Outputs(this); - } -} - -export class SetLedgerCall__Inputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } - - get _contractAddress(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class SetLedgerCall__Outputs { - _call: SetLedgerCall; - - constructor(call: SetLedgerCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} - -export class TransferTokenCall extends ethereum.Call { - get inputs(): TransferTokenCall__Inputs { - return new TransferTokenCall__Inputs(this); - } - - get outputs(): TransferTokenCall__Outputs { - return new TransferTokenCall__Outputs(this); - } -} - -export class TransferTokenCall__Inputs { - _call: TransferTokenCall; - - constructor(call: TransferTokenCall) { - this._call = call; - } - - get _from(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _to(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _amount(): BigInt { - return this._call.inputValues[2].value.toBigInt(); - } - - get _signature(): Bytes { - return this._call.inputValues[3].value.toBytes(); - } -} - -export class TransferTokenCall__Outputs { - _call: TransferTokenCall; - - constructor(call: TransferTokenCall) { - this._call = call; - } -} - -export class UpgradeToCall extends ethereum.Call { - get inputs(): UpgradeToCall__Inputs { - return new UpgradeToCall__Inputs(this); - } - - get outputs(): UpgradeToCall__Outputs { - return new UpgradeToCall__Outputs(this); - } -} - -export class UpgradeToCall__Inputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class UpgradeToCall__Outputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } -} - -export class UpgradeToAndCallCall extends ethereum.Call { - get inputs(): UpgradeToAndCallCall__Inputs { - return new UpgradeToAndCallCall__Inputs(this); - } - - get outputs(): UpgradeToAndCallCall__Outputs { - return new UpgradeToAndCallCall__Outputs(this); - } -} - -export class UpgradeToAndCallCall__Inputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get data(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class UpgradeToAndCallCall__Outputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } -} diff --git a/packages/subgraph/generated/Shop/Shop.ts b/packages/subgraph/generated/Shop/Shop.ts deleted file mode 100644 index 62b6e051..00000000 --- a/packages/subgraph/generated/Shop/Shop.ts +++ /dev/null @@ -1,1308 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class AddedShop extends ethereum.Event { - get params(): AddedShop__Params { - return new AddedShop__Params(this); - } -} - -export class AddedShop__Params { - _event: AddedShop; - - constructor(event: AddedShop) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get name(): string { - return this._event.parameters[1].value.toString(); - } - - get currency(): string { - return this._event.parameters[2].value.toString(); - } - - get account(): Address { - return this._event.parameters[3].value.toAddress(); - } - - get status(): i32 { - return this._event.parameters[4].value.toI32(); - } -} - -export class AdminChanged extends ethereum.Event { - get params(): AdminChanged__Params { - return new AdminChanged__Params(this); - } -} - -export class AdminChanged__Params { - _event: AdminChanged; - - constructor(event: AdminChanged) { - this._event = event; - } - - get previousAdmin(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newAdmin(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class BeaconUpgraded extends ethereum.Event { - get params(): BeaconUpgraded__Params { - return new BeaconUpgraded__Params(this); - } -} - -export class BeaconUpgraded__Params { - _event: BeaconUpgraded; - - constructor(event: BeaconUpgraded) { - this._event = event; - } - - get beacon(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class ChangedShopStatus extends ethereum.Event { - get params(): ChangedShopStatus__Params { - return new ChangedShopStatus__Params(this); - } -} - -export class ChangedShopStatus__Params { - _event: ChangedShopStatus; - - constructor(event: ChangedShopStatus) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get status(): i32 { - return this._event.parameters[1].value.toI32(); - } -} - -export class ClosedWithdrawal extends ethereum.Event { - get params(): ClosedWithdrawal__Params { - return new ClosedWithdrawal__Params(this); - } -} - -export class ClosedWithdrawal__Params { - _event: ClosedWithdrawal; - - constructor(event: ClosedWithdrawal) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get amount(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get total(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get account(): Address { - return this._event.parameters[4].value.toAddress(); - } - - get withdrawId(): BigInt { - return this._event.parameters[5].value.toBigInt(); - } -} - -export class DecreasedUsedAmount extends ethereum.Event { - get params(): DecreasedUsedAmount__Params { - return new DecreasedUsedAmount__Params(this); - } -} - -export class DecreasedUsedAmount__Params { - _event: DecreasedUsedAmount; - - constructor(event: DecreasedUsedAmount) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get increase(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get total(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get purchaseId(): string { - return this._event.parameters[4].value.toString(); - } - - get paymentId(): Bytes { - return this._event.parameters[5].value.toBytes(); - } -} - -export class IncreasedProvidedAmount extends ethereum.Event { - get params(): IncreasedProvidedAmount__Params { - return new IncreasedProvidedAmount__Params(this); - } -} - -export class IncreasedProvidedAmount__Params { - _event: IncreasedProvidedAmount; - - constructor(event: IncreasedProvidedAmount) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get increase(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get total(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get purchaseId(): string { - return this._event.parameters[4].value.toString(); - } -} - -export class IncreasedSettledAmount extends ethereum.Event { - get params(): IncreasedSettledAmount__Params { - return new IncreasedSettledAmount__Params(this); - } -} - -export class IncreasedSettledAmount__Params { - _event: IncreasedSettledAmount; - - constructor(event: IncreasedSettledAmount) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get increase(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get total(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get purchaseId(): string { - return this._event.parameters[4].value.toString(); - } -} - -export class IncreasedUsedAmount extends ethereum.Event { - get params(): IncreasedUsedAmount__Params { - return new IncreasedUsedAmount__Params(this); - } -} - -export class IncreasedUsedAmount__Params { - _event: IncreasedUsedAmount; - - constructor(event: IncreasedUsedAmount) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get increase(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get total(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[3].value.toString(); - } - - get purchaseId(): string { - return this._event.parameters[4].value.toString(); - } - - get paymentId(): Bytes { - return this._event.parameters[5].value.toBytes(); - } -} - -export class Initialized extends ethereum.Event { - get params(): Initialized__Params { - return new Initialized__Params(this); - } -} - -export class Initialized__Params { - _event: Initialized; - - constructor(event: Initialized) { - this._event = event; - } - - get version(): i32 { - return this._event.parameters[0].value.toI32(); - } -} - -export class OpenedWithdrawal extends ethereum.Event { - get params(): OpenedWithdrawal__Params { - return new OpenedWithdrawal__Params(this); - } -} - -export class OpenedWithdrawal__Params { - _event: OpenedWithdrawal; - - constructor(event: OpenedWithdrawal) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get amount(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get currency(): string { - return this._event.parameters[2].value.toString(); - } - - get account(): Address { - return this._event.parameters[3].value.toAddress(); - } - - get withdrawId(): BigInt { - return this._event.parameters[4].value.toBigInt(); - } -} - -export class OwnershipTransferred extends ethereum.Event { - get params(): OwnershipTransferred__Params { - return new OwnershipTransferred__Params(this); - } -} - -export class OwnershipTransferred__Params { - _event: OwnershipTransferred; - - constructor(event: OwnershipTransferred) { - this._event = event; - } - - get previousOwner(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get newOwner(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class UpdatedShop extends ethereum.Event { - get params(): UpdatedShop__Params { - return new UpdatedShop__Params(this); - } -} - -export class UpdatedShop__Params { - _event: UpdatedShop; - - constructor(event: UpdatedShop) { - this._event = event; - } - - get shopId(): Bytes { - return this._event.parameters[0].value.toBytes(); - } - - get name(): string { - return this._event.parameters[1].value.toString(); - } - - get currency(): string { - return this._event.parameters[2].value.toString(); - } - - get account(): Address { - return this._event.parameters[3].value.toAddress(); - } - - get status(): i32 { - return this._event.parameters[4].value.toI32(); - } -} - -export class Upgraded extends ethereum.Event { - get params(): Upgraded__Params { - return new Upgraded__Params(this); - } -} - -export class Upgraded__Params { - _event: Upgraded; - - constructor(event: Upgraded) { - this._event = event; - } - - get implementation(): Address { - return this._event.parameters[0].value.toAddress(); - } -} - -export class Shop__shopOfResultValue0Struct extends ethereum.Tuple { - get shopId(): Bytes { - return this[0].toBytes(); - } - - get name(): string { - return this[1].toString(); - } - - get currency(): string { - return this[2].toString(); - } - - get account(): Address { - return this[3].toAddress(); - } - - get providedAmount(): BigInt { - return this[4].toBigInt(); - } - - get usedAmount(): BigInt { - return this[5].toBigInt(); - } - - get settledAmount(): BigInt { - return this[6].toBigInt(); - } - - get withdrawnAmount(): BigInt { - return this[7].toBigInt(); - } - - get status(): i32 { - return this[8].toI32(); - } - - get withdrawData(): Shop__shopOfResultValue0WithdrawDataStruct { - return changetype( - this[9].toTuple() - ); - } - - get itemIndex(): BigInt { - return this[10].toBigInt(); - } - - get accountIndex(): BigInt { - return this[11].toBigInt(); - } -} - -export class Shop__shopOfResultValue0WithdrawDataStruct extends ethereum.Tuple { - get id(): BigInt { - return this[0].toBigInt(); - } - - get amount(): BigInt { - return this[1].toBigInt(); - } - - get status(): i32 { - return this[2].toI32(); - } -} - -export class Shop extends ethereum.SmartContract { - static bind(address: Address): Shop { - return new Shop("Shop", address); - } - - consumerAddress(): Address { - let result = super.call( - "consumerAddress", - "consumerAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_consumerAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "consumerAddress", - "consumerAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - getSettlementAmount(_shopId: Bytes): BigInt { - let result = super.call( - "getSettlementAmount", - "getSettlementAmount(bytes32):(uint256)", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - - return result[0].toBigInt(); - } - - try_getSettlementAmount(_shopId: Bytes): ethereum.CallResult { - let result = super.tryCall( - "getSettlementAmount", - "getSettlementAmount(bytes32):(uint256)", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - getShopsCountOfAccount(_account: Address): BigInt { - let result = super.call( - "getShopsCountOfAccount", - "getShopsCountOfAccount(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - - return result[0].toBigInt(); - } - - try_getShopsCountOfAccount(_account: Address): ethereum.CallResult { - let result = super.tryCall( - "getShopsCountOfAccount", - "getShopsCountOfAccount(address):(uint256)", - [ethereum.Value.fromAddress(_account)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - getShopsOfAccount( - _account: Address, - _from: BigInt, - _to: BigInt - ): Array { - let result = super.call( - "getShopsOfAccount", - "getShopsOfAccount(address,uint256,uint256):(bytes32[])", - [ - ethereum.Value.fromAddress(_account), - ethereum.Value.fromUnsignedBigInt(_from), - ethereum.Value.fromUnsignedBigInt(_to) - ] - ); - - return result[0].toBytesArray(); - } - - try_getShopsOfAccount( - _account: Address, - _from: BigInt, - _to: BigInt - ): ethereum.CallResult> { - let result = super.tryCall( - "getShopsOfAccount", - "getShopsOfAccount(address,uint256,uint256):(bytes32[])", - [ - ethereum.Value.fromAddress(_account), - ethereum.Value.fromUnsignedBigInt(_from), - ethereum.Value.fromUnsignedBigInt(_to) - ] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytesArray()); - } - - isAvailableId(_shopId: Bytes): boolean { - let result = super.call("isAvailableId", "isAvailableId(bytes32):(bool)", [ - ethereum.Value.fromFixedBytes(_shopId) - ]); - - return result[0].toBoolean(); - } - - try_isAvailableId(_shopId: Bytes): ethereum.CallResult { - let result = super.tryCall( - "isAvailableId", - "isAvailableId(bytes32):(bool)", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBoolean()); - } - - nonceOf(_account: Address): BigInt { - let result = super.call("nonceOf", "nonceOf(address):(uint256)", [ - ethereum.Value.fromAddress(_account) - ]); - - return result[0].toBigInt(); - } - - try_nonceOf(_account: Address): ethereum.CallResult { - let result = super.tryCall("nonceOf", "nonceOf(address):(uint256)", [ - ethereum.Value.fromAddress(_account) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - owner(): Address { - let result = super.call("owner", "owner():(address)", []); - - return result[0].toAddress(); - } - - try_owner(): ethereum.CallResult
{ - let result = super.tryCall("owner", "owner():(address)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - providerAddress(): Address { - let result = super.call( - "providerAddress", - "providerAddress():(address)", - [] - ); - - return result[0].toAddress(); - } - - try_providerAddress(): ethereum.CallResult
{ - let result = super.tryCall( - "providerAddress", - "providerAddress():(address)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toAddress()); - } - - proxiableUUID(): Bytes { - let result = super.call("proxiableUUID", "proxiableUUID():(bytes32)", []); - - return result[0].toBytes(); - } - - try_proxiableUUID(): ethereum.CallResult { - let result = super.tryCall( - "proxiableUUID", - "proxiableUUID():(bytes32)", - [] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } - - shopIdOf(_idx: BigInt): Bytes { - let result = super.call("shopIdOf", "shopIdOf(uint256):(bytes32)", [ - ethereum.Value.fromUnsignedBigInt(_idx) - ]); - - return result[0].toBytes(); - } - - try_shopIdOf(_idx: BigInt): ethereum.CallResult { - let result = super.tryCall("shopIdOf", "shopIdOf(uint256):(bytes32)", [ - ethereum.Value.fromUnsignedBigInt(_idx) - ]); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBytes()); - } - - shopOf(_shopId: Bytes): Shop__shopOfResultValue0Struct { - let result = super.call( - "shopOf", - "shopOf(bytes32):((bytes32,string,string,address,uint256,uint256,uint256,uint256,uint8,(uint256,uint256,uint8),uint256,uint256))", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - - return changetype(result[0].toTuple()); - } - - try_shopOf( - _shopId: Bytes - ): ethereum.CallResult { - let result = super.tryCall( - "shopOf", - "shopOf(bytes32):((bytes32,string,string,address,uint256,uint256,uint256,uint256,uint8,(uint256,uint256,uint8),uint256,uint256))", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue( - changetype(value[0].toTuple()) - ); - } - - shopsLength(): BigInt { - let result = super.call("shopsLength", "shopsLength():(uint256)", []); - - return result[0].toBigInt(); - } - - try_shopsLength(): ethereum.CallResult { - let result = super.tryCall("shopsLength", "shopsLength():(uint256)", []); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - withdrawableOf(_shopId: Bytes): BigInt { - let result = super.call( - "withdrawableOf", - "withdrawableOf(bytes32):(uint256)", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - - return result[0].toBigInt(); - } - - try_withdrawableOf(_shopId: Bytes): ethereum.CallResult { - let result = super.tryCall( - "withdrawableOf", - "withdrawableOf(bytes32):(uint256)", - [ethereum.Value.fromFixedBytes(_shopId)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } -} - -export class AddCall extends ethereum.Call { - get inputs(): AddCall__Inputs { - return new AddCall__Inputs(this); - } - - get outputs(): AddCall__Outputs { - return new AddCall__Outputs(this); - } -} - -export class AddCall__Inputs { - _call: AddCall; - - constructor(call: AddCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _name(): string { - return this._call.inputValues[1].value.toString(); - } - - get _currency(): string { - return this._call.inputValues[2].value.toString(); - } - - get _account(): Address { - return this._call.inputValues[3].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[4].value.toBytes(); - } -} - -export class AddCall__Outputs { - _call: AddCall; - - constructor(call: AddCall) { - this._call = call; - } -} - -export class AddProvidedAmountCall extends ethereum.Call { - get inputs(): AddProvidedAmountCall__Inputs { - return new AddProvidedAmountCall__Inputs(this); - } - - get outputs(): AddProvidedAmountCall__Outputs { - return new AddProvidedAmountCall__Outputs(this); - } -} - -export class AddProvidedAmountCall__Inputs { - _call: AddProvidedAmountCall; - - constructor(call: AddProvidedAmountCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _value(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _purchaseId(): string { - return this._call.inputValues[2].value.toString(); - } -} - -export class AddProvidedAmountCall__Outputs { - _call: AddProvidedAmountCall; - - constructor(call: AddProvidedAmountCall) { - this._call = call; - } -} - -export class AddSettledAmountCall extends ethereum.Call { - get inputs(): AddSettledAmountCall__Inputs { - return new AddSettledAmountCall__Inputs(this); - } - - get outputs(): AddSettledAmountCall__Outputs { - return new AddSettledAmountCall__Outputs(this); - } -} - -export class AddSettledAmountCall__Inputs { - _call: AddSettledAmountCall; - - constructor(call: AddSettledAmountCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _value(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _purchaseId(): string { - return this._call.inputValues[2].value.toString(); - } -} - -export class AddSettledAmountCall__Outputs { - _call: AddSettledAmountCall; - - constructor(call: AddSettledAmountCall) { - this._call = call; - } -} - -export class AddUsedAmountCall extends ethereum.Call { - get inputs(): AddUsedAmountCall__Inputs { - return new AddUsedAmountCall__Inputs(this); - } - - get outputs(): AddUsedAmountCall__Outputs { - return new AddUsedAmountCall__Outputs(this); - } -} - -export class AddUsedAmountCall__Inputs { - _call: AddUsedAmountCall; - - constructor(call: AddUsedAmountCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _value(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _purchaseId(): string { - return this._call.inputValues[2].value.toString(); - } - - get _paymentId(): Bytes { - return this._call.inputValues[3].value.toBytes(); - } -} - -export class AddUsedAmountCall__Outputs { - _call: AddUsedAmountCall; - - constructor(call: AddUsedAmountCall) { - this._call = call; - } -} - -export class ChangeStatusCall extends ethereum.Call { - get inputs(): ChangeStatusCall__Inputs { - return new ChangeStatusCall__Inputs(this); - } - - get outputs(): ChangeStatusCall__Outputs { - return new ChangeStatusCall__Outputs(this); - } -} - -export class ChangeStatusCall__Inputs { - _call: ChangeStatusCall; - - constructor(call: ChangeStatusCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _status(): i32 { - return this._call.inputValues[1].value.toI32(); - } - - get _account(): Address { - return this._call.inputValues[2].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[3].value.toBytes(); - } -} - -export class ChangeStatusCall__Outputs { - _call: ChangeStatusCall; - - constructor(call: ChangeStatusCall) { - this._call = call; - } -} - -export class CloseWithdrawalCall extends ethereum.Call { - get inputs(): CloseWithdrawalCall__Inputs { - return new CloseWithdrawalCall__Inputs(this); - } - - get outputs(): CloseWithdrawalCall__Outputs { - return new CloseWithdrawalCall__Outputs(this); - } -} - -export class CloseWithdrawalCall__Inputs { - _call: CloseWithdrawalCall; - - constructor(call: CloseWithdrawalCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _account(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[2].value.toBytes(); - } -} - -export class CloseWithdrawalCall__Outputs { - _call: CloseWithdrawalCall; - - constructor(call: CloseWithdrawalCall) { - this._call = call; - } -} - -export class InitializeCall extends ethereum.Call { - get inputs(): InitializeCall__Inputs { - return new InitializeCall__Inputs(this); - } - - get outputs(): InitializeCall__Outputs { - return new InitializeCall__Outputs(this); - } -} - -export class InitializeCall__Inputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } - - get _currencyRate(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get _providerAddress(): Address { - return this._call.inputValues[1].value.toAddress(); - } - - get _consumerAddress(): Address { - return this._call.inputValues[2].value.toAddress(); - } -} - -export class InitializeCall__Outputs { - _call: InitializeCall; - - constructor(call: InitializeCall) { - this._call = call; - } -} - -export class OpenWithdrawalCall extends ethereum.Call { - get inputs(): OpenWithdrawalCall__Inputs { - return new OpenWithdrawalCall__Inputs(this); - } - - get outputs(): OpenWithdrawalCall__Outputs { - return new OpenWithdrawalCall__Outputs(this); - } -} - -export class OpenWithdrawalCall__Inputs { - _call: OpenWithdrawalCall; - - constructor(call: OpenWithdrawalCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _amount(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _account(): Address { - return this._call.inputValues[2].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[3].value.toBytes(); - } -} - -export class OpenWithdrawalCall__Outputs { - _call: OpenWithdrawalCall; - - constructor(call: OpenWithdrawalCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall extends ethereum.Call { - get inputs(): RenounceOwnershipCall__Inputs { - return new RenounceOwnershipCall__Inputs(this); - } - - get outputs(): RenounceOwnershipCall__Outputs { - return new RenounceOwnershipCall__Outputs(this); - } -} - -export class RenounceOwnershipCall__Inputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class RenounceOwnershipCall__Outputs { - _call: RenounceOwnershipCall; - - constructor(call: RenounceOwnershipCall) { - this._call = call; - } -} - -export class SubUsedAmountCall extends ethereum.Call { - get inputs(): SubUsedAmountCall__Inputs { - return new SubUsedAmountCall__Inputs(this); - } - - get outputs(): SubUsedAmountCall__Outputs { - return new SubUsedAmountCall__Outputs(this); - } -} - -export class SubUsedAmountCall__Inputs { - _call: SubUsedAmountCall; - - constructor(call: SubUsedAmountCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _value(): BigInt { - return this._call.inputValues[1].value.toBigInt(); - } - - get _purchaseId(): string { - return this._call.inputValues[2].value.toString(); - } - - get _paymentId(): Bytes { - return this._call.inputValues[3].value.toBytes(); - } -} - -export class SubUsedAmountCall__Outputs { - _call: SubUsedAmountCall; - - constructor(call: SubUsedAmountCall) { - this._call = call; - } -} - -export class TransferOwnershipCall extends ethereum.Call { - get inputs(): TransferOwnershipCall__Inputs { - return new TransferOwnershipCall__Inputs(this); - } - - get outputs(): TransferOwnershipCall__Outputs { - return new TransferOwnershipCall__Outputs(this); - } -} - -export class TransferOwnershipCall__Inputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } - - get newOwner(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class TransferOwnershipCall__Outputs { - _call: TransferOwnershipCall; - - constructor(call: TransferOwnershipCall) { - this._call = call; - } -} - -export class UpdateCall extends ethereum.Call { - get inputs(): UpdateCall__Inputs { - return new UpdateCall__Inputs(this); - } - - get outputs(): UpdateCall__Outputs { - return new UpdateCall__Outputs(this); - } -} - -export class UpdateCall__Inputs { - _call: UpdateCall; - - constructor(call: UpdateCall) { - this._call = call; - } - - get _shopId(): Bytes { - return this._call.inputValues[0].value.toBytes(); - } - - get _name(): string { - return this._call.inputValues[1].value.toString(); - } - - get _currency(): string { - return this._call.inputValues[2].value.toString(); - } - - get _account(): Address { - return this._call.inputValues[3].value.toAddress(); - } - - get _signature(): Bytes { - return this._call.inputValues[4].value.toBytes(); - } -} - -export class UpdateCall__Outputs { - _call: UpdateCall; - - constructor(call: UpdateCall) { - this._call = call; - } -} - -export class UpgradeToCall extends ethereum.Call { - get inputs(): UpgradeToCall__Inputs { - return new UpgradeToCall__Inputs(this); - } - - get outputs(): UpgradeToCall__Outputs { - return new UpgradeToCall__Outputs(this); - } -} - -export class UpgradeToCall__Inputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } -} - -export class UpgradeToCall__Outputs { - _call: UpgradeToCall; - - constructor(call: UpgradeToCall) { - this._call = call; - } -} - -export class UpgradeToAndCallCall extends ethereum.Call { - get inputs(): UpgradeToAndCallCall__Inputs { - return new UpgradeToAndCallCall__Inputs(this); - } - - get outputs(): UpgradeToAndCallCall__Outputs { - return new UpgradeToAndCallCall__Outputs(this); - } -} - -export class UpgradeToAndCallCall__Inputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } - - get newImplementation(): Address { - return this._call.inputValues[0].value.toAddress(); - } - - get data(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class UpgradeToAndCallCall__Outputs { - _call: UpgradeToAndCallCall; - - constructor(call: UpgradeToAndCallCall) { - this._call = call; - } -} diff --git a/packages/subgraph/generated/schema.ts b/packages/subgraph/generated/schema.ts deleted file mode 100644 index 3fe75fb8..00000000 --- a/packages/subgraph/generated/schema.ts +++ /dev/null @@ -1,1617 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - TypedMap, - Entity, - Value, - ValueKind, - store, - Bytes, - BigInt, - BigDecimal -} from "@graphprotocol/graph-ts"; - -export class SavedPurchase extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save SavedPurchase entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type SavedPurchase must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("SavedPurchase", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): SavedPurchase | null { - return changetype( - store.get_in_block("SavedPurchase", id.toHexString()) - ); - } - - static load(id: Bytes): SavedPurchase | null { - return changetype( - store.get("SavedPurchase", id.toHexString()) - ); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get purchaseId(): string { - let value = this.get("purchaseId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set purchaseId(value: string) { - this.set("purchaseId", Value.fromString(value)); - } - - get amount(): BigInt { - let value = this.get("amount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set amount(value: BigInt) { - this.set("amount", Value.fromBigInt(value)); - } - - get loyalty(): BigInt { - let value = this.get("loyalty"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set loyalty(value: BigInt) { - this.set("loyalty", Value.fromBigInt(value)); - } - - get currency(): string { - let value = this.get("currency"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set currency(value: string) { - this.set("currency", Value.fromString(value)); - } - - get shopId(): Bytes { - let value = this.get("shopId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set shopId(value: Bytes) { - this.set("shopId", Value.fromBytes(value)); - } - - get account(): Bytes { - let value = this.get("account"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set account(value: Bytes) { - this.set("account", Value.fromBytes(value)); - } - - get phone(): Bytes { - let value = this.get("phone"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set phone(value: Bytes) { - this.set("phone", Value.fromBytes(value)); - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class LoyaltyPaymentEvent extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save LoyaltyPaymentEvent entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type LoyaltyPaymentEvent must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("LoyaltyPaymentEvent", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): LoyaltyPaymentEvent | null { - return changetype( - store.get_in_block("LoyaltyPaymentEvent", id.toHexString()) - ); - } - - static load(id: Bytes): LoyaltyPaymentEvent | null { - return changetype( - store.get("LoyaltyPaymentEvent", id.toHexString()) - ); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get paymentId(): Bytes { - let value = this.get("paymentId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set paymentId(value: Bytes) { - this.set("paymentId", Value.fromBytes(value)); - } - - get purchaseId(): string { - let value = this.get("purchaseId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set purchaseId(value: string) { - this.set("purchaseId", Value.fromString(value)); - } - - get currency(): string { - let value = this.get("currency"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set currency(value: string) { - this.set("currency", Value.fromString(value)); - } - - get shopId(): Bytes { - let value = this.get("shopId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set shopId(value: Bytes) { - this.set("shopId", Value.fromBytes(value)); - } - - get account(): Bytes { - let value = this.get("account"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set account(value: Bytes) { - this.set("account", Value.fromBytes(value)); - } - - get timestamp(): BigInt { - let value = this.get("timestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set timestamp(value: BigInt) { - this.set("timestamp", Value.fromBigInt(value)); - } - - get loyaltyType(): i32 { - let value = this.get("loyaltyType"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set loyaltyType(value: i32) { - this.set("loyaltyType", Value.fromI32(value)); - } - - get paidPoint(): BigInt { - let value = this.get("paidPoint"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set paidPoint(value: BigInt) { - this.set("paidPoint", Value.fromBigInt(value)); - } - - get paidToken(): BigInt { - let value = this.get("paidToken"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set paidToken(value: BigInt) { - this.set("paidToken", Value.fromBigInt(value)); - } - - get paidValue(): BigInt { - let value = this.get("paidValue"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set paidValue(value: BigInt) { - this.set("paidValue", Value.fromBigInt(value)); - } - - get feePoint(): BigInt { - let value = this.get("feePoint"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set feePoint(value: BigInt) { - this.set("feePoint", Value.fromBigInt(value)); - } - - get feeToken(): BigInt { - let value = this.get("feeToken"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set feeToken(value: BigInt) { - this.set("feeToken", Value.fromBigInt(value)); - } - - get feeValue(): BigInt { - let value = this.get("feeValue"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set feeValue(value: BigInt) { - this.set("feeValue", Value.fromBigInt(value)); - } - - get status(): i32 { - let value = this.get("status"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set status(value: i32) { - this.set("status", Value.fromI32(value)); - } - - get balance(): BigInt { - let value = this.get("balance"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set balance(value: BigInt) { - this.set("balance", Value.fromBigInt(value)); - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class UserTradeHistory extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save UserTradeHistory entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type UserTradeHistory must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("UserTradeHistory", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): UserTradeHistory | null { - return changetype( - store.get_in_block("UserTradeHistory", id.toHexString()) - ); - } - - static load(id: Bytes): UserTradeHistory | null { - return changetype( - store.get("UserTradeHistory", id.toHexString()) - ); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get account(): Bytes { - let value = this.get("account"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set account(value: Bytes) { - this.set("account", Value.fromBytes(value)); - } - - get pageType(): i32 { - let value = this.get("pageType"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set pageType(value: i32) { - this.set("pageType", Value.fromI32(value)); - } - - get action(): i32 { - let value = this.get("action"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set action(value: i32) { - this.set("action", Value.fromI32(value)); - } - - get cancel(): boolean { - let value = this.get("cancel"); - if (!value || value.kind == ValueKind.NULL) { - return false; - } else { - return value.toBoolean(); - } - } - - set cancel(value: boolean) { - this.set("cancel", Value.fromBoolean(value)); - } - - get loyaltyType(): i32 { - let value = this.get("loyaltyType"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set loyaltyType(value: i32) { - this.set("loyaltyType", Value.fromI32(value)); - } - - get amountPoint(): BigInt { - let value = this.get("amountPoint"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set amountPoint(value: BigInt) { - this.set("amountPoint", Value.fromBigInt(value)); - } - - get amountToken(): BigInt { - let value = this.get("amountToken"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set amountToken(value: BigInt) { - this.set("amountToken", Value.fromBigInt(value)); - } - - get amountValue(): BigInt { - let value = this.get("amountValue"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set amountValue(value: BigInt) { - this.set("amountValue", Value.fromBigInt(value)); - } - - get currency(): string | null { - let value = this.get("currency"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toString(); - } - } - - set currency(value: string | null) { - if (!value) { - this.unset("currency"); - } else { - this.set("currency", Value.fromString(value)); - } - } - - get balancePoint(): BigInt { - let value = this.get("balancePoint"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set balancePoint(value: BigInt) { - this.set("balancePoint", Value.fromBigInt(value)); - } - - get balanceToken(): BigInt { - let value = this.get("balanceToken"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set balanceToken(value: BigInt) { - this.set("balanceToken", Value.fromBigInt(value)); - } - - get purchaseId(): string | null { - let value = this.get("purchaseId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toString(); - } - } - - set purchaseId(value: string | null) { - if (!value) { - this.unset("purchaseId"); - } else { - this.set("purchaseId", Value.fromString(value)); - } - } - - get paymentId(): Bytes | null { - let value = this.get("paymentId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toBytes(); - } - } - - set paymentId(value: Bytes | null) { - if (!value) { - this.unset("paymentId"); - } else { - this.set("paymentId", Value.fromBytes(value)); - } - } - - get shopId(): Bytes | null { - let value = this.get("shopId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toBytes(); - } - } - - set shopId(value: Bytes | null) { - if (!value) { - this.unset("shopId"); - } else { - this.set("shopId", Value.fromBytes(value)); - } - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class UserUnPayableTradeHistory extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert( - id != null, - "Cannot save UserUnPayableTradeHistory entity without an ID" - ); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type UserUnPayableTradeHistory must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("UserUnPayableTradeHistory", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): UserUnPayableTradeHistory | null { - return changetype( - store.get_in_block("UserUnPayableTradeHistory", id.toHexString()) - ); - } - - static load(id: Bytes): UserUnPayableTradeHistory | null { - return changetype( - store.get("UserUnPayableTradeHistory", id.toHexString()) - ); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get phone(): Bytes { - let value = this.get("phone"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set phone(value: Bytes) { - this.set("phone", Value.fromBytes(value)); - } - - get action(): i32 { - let value = this.get("action"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set action(value: i32) { - this.set("action", Value.fromI32(value)); - } - - get amount(): BigInt { - let value = this.get("amount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set amount(value: BigInt) { - this.set("amount", Value.fromBigInt(value)); - } - - get balance(): BigInt { - let value = this.get("balance"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set balance(value: BigInt) { - this.set("balance", Value.fromBigInt(value)); - } - - get purchaseId(): string | null { - let value = this.get("purchaseId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toString(); - } - } - - set purchaseId(value: string | null) { - if (!value) { - this.unset("purchaseId"); - } else { - this.set("purchaseId", Value.fromString(value)); - } - } - - get shopId(): Bytes | null { - let value = this.get("shopId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toBytes(); - } - } - - set shopId(value: Bytes | null) { - if (!value) { - this.unset("shopId"); - } else { - this.set("shopId", Value.fromBytes(value)); - } - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class UserBalance extends Entity { - constructor(id: string) { - super(); - this.set("id", Value.fromString(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save UserBalance entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.STRING, - `Entities of type UserBalance must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("UserBalance", id.toString(), this); - } - } - - static loadInBlock(id: string): UserBalance | null { - return changetype( - store.get_in_block("UserBalance", id) - ); - } - - static load(id: string): UserBalance | null { - return changetype(store.get("UserBalance", id)); - } - - get id(): string { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set id(value: string) { - this.set("id", Value.fromString(value)); - } - - get point(): BigInt { - let value = this.get("point"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set point(value: BigInt) { - this.set("point", Value.fromBigInt(value)); - } - - get token(): BigInt { - let value = this.get("token"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set token(value: BigInt) { - this.set("token", Value.fromBigInt(value)); - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class ShopTradeHistory extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save ShopTradeHistory entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type ShopTradeHistory must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("ShopTradeHistory", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): ShopTradeHistory | null { - return changetype( - store.get_in_block("ShopTradeHistory", id.toHexString()) - ); - } - - static load(id: Bytes): ShopTradeHistory | null { - return changetype( - store.get("ShopTradeHistory", id.toHexString()) - ); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get shopId(): Bytes { - let value = this.get("shopId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set shopId(value: Bytes) { - this.set("shopId", Value.fromBytes(value)); - } - - get pageType(): i32 { - let value = this.get("pageType"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set pageType(value: i32) { - this.set("pageType", Value.fromI32(value)); - } - - get action(): i32 { - let value = this.get("action"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set action(value: i32) { - this.set("action", Value.fromI32(value)); - } - - get cancel(): boolean { - let value = this.get("cancel"); - if (!value || value.kind == ValueKind.NULL) { - return false; - } else { - return value.toBoolean(); - } - } - - set cancel(value: boolean) { - this.set("cancel", Value.fromBoolean(value)); - } - - get increase(): BigInt { - let value = this.get("increase"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set increase(value: BigInt) { - this.set("increase", Value.fromBigInt(value)); - } - - get currency(): string { - let value = this.get("currency"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set currency(value: string) { - this.set("currency", Value.fromString(value)); - } - - get providedAmount(): BigInt { - let value = this.get("providedAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set providedAmount(value: BigInt) { - this.set("providedAmount", Value.fromBigInt(value)); - } - - get usedAmount(): BigInt { - let value = this.get("usedAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set usedAmount(value: BigInt) { - this.set("usedAmount", Value.fromBigInt(value)); - } - - get settledAmount(): BigInt { - let value = this.get("settledAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set settledAmount(value: BigInt) { - this.set("settledAmount", Value.fromBigInt(value)); - } - - get withdrawnAmount(): BigInt { - let value = this.get("withdrawnAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set withdrawnAmount(value: BigInt) { - this.set("withdrawnAmount", Value.fromBigInt(value)); - } - - get purchaseId(): string | null { - let value = this.get("purchaseId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toString(); - } - } - - set purchaseId(value: string | null) { - if (!value) { - this.unset("purchaseId"); - } else { - this.set("purchaseId", Value.fromString(value)); - } - } - - get paymentId(): Bytes | null { - let value = this.get("paymentId"); - if (!value || value.kind == ValueKind.NULL) { - return null; - } else { - return value.toBytes(); - } - } - - set paymentId(value: Bytes | null) { - if (!value) { - this.unset("paymentId"); - } else { - this.set("paymentId", Value.fromBytes(value)); - } - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class Shop extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save Shop entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type Shop must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("Shop", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): Shop | null { - return changetype( - store.get_in_block("Shop", id.toHexString()) - ); - } - - static load(id: Bytes): Shop | null { - return changetype(store.get("Shop", id.toHexString())); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get name(): string { - let value = this.get("name"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set name(value: string) { - this.set("name", Value.fromString(value)); - } - - get currency(): string { - let value = this.get("currency"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set currency(value: string) { - this.set("currency", Value.fromString(value)); - } - - get status(): i32 { - let value = this.get("status"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set status(value: i32) { - this.set("status", Value.fromI32(value)); - } - - get account(): Bytes { - let value = this.get("account"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set account(value: Bytes) { - this.set("account", Value.fromBytes(value)); - } - - get action(): i32 { - let value = this.get("action"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set action(value: i32) { - this.set("action", Value.fromI32(value)); - } - - get providedAmount(): BigInt { - let value = this.get("providedAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set providedAmount(value: BigInt) { - this.set("providedAmount", Value.fromBigInt(value)); - } - - get usedAmount(): BigInt { - let value = this.get("usedAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set usedAmount(value: BigInt) { - this.set("usedAmount", Value.fromBigInt(value)); - } - - get settledAmount(): BigInt { - let value = this.get("settledAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set settledAmount(value: BigInt) { - this.set("settledAmount", Value.fromBigInt(value)); - } - - get withdrawnAmount(): BigInt { - let value = this.get("withdrawnAmount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set withdrawnAmount(value: BigInt) { - this.set("withdrawnAmount", Value.fromBigInt(value)); - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} - -export class ShopWithdraw extends Entity { - constructor(id: Bytes) { - super(); - this.set("id", Value.fromBytes(id)); - } - - save(): void { - let id = this.get("id"); - assert(id != null, "Cannot save ShopWithdraw entity without an ID"); - if (id) { - assert( - id.kind == ValueKind.BYTES, - `Entities of type ShopWithdraw must have an ID of type Bytes but the id '${id.displayData()}' is of type ${id.displayKind()}` - ); - store.set("ShopWithdraw", id.toBytes().toHexString(), this); - } - } - - static loadInBlock(id: Bytes): ShopWithdraw | null { - return changetype( - store.get_in_block("ShopWithdraw", id.toHexString()) - ); - } - - static load(id: Bytes): ShopWithdraw | null { - return changetype( - store.get("ShopWithdraw", id.toHexString()) - ); - } - - get id(): Bytes { - let value = this.get("id"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set id(value: Bytes) { - this.set("id", Value.fromBytes(value)); - } - - get amount(): BigInt { - let value = this.get("amount"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set amount(value: BigInt) { - this.set("amount", Value.fromBigInt(value)); - } - - get currency(): string { - let value = this.get("currency"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toString(); - } - } - - set currency(value: string) { - this.set("currency", Value.fromString(value)); - } - - get account(): Bytes { - let value = this.get("account"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set account(value: Bytes) { - this.set("account", Value.fromBytes(value)); - } - - get withdrawId(): BigInt { - let value = this.get("withdrawId"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set withdrawId(value: BigInt) { - this.set("withdrawId", Value.fromBigInt(value)); - } - - get status(): i32 { - let value = this.get("status"); - if (!value || value.kind == ValueKind.NULL) { - return 0; - } else { - return value.toI32(); - } - } - - set status(value: i32) { - this.set("status", Value.fromI32(value)); - } - - get blockNumber(): BigInt { - let value = this.get("blockNumber"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockNumber(value: BigInt) { - this.set("blockNumber", Value.fromBigInt(value)); - } - - get blockTimestamp(): BigInt { - let value = this.get("blockTimestamp"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBigInt(); - } - } - - set blockTimestamp(value: BigInt) { - this.set("blockTimestamp", Value.fromBigInt(value)); - } - - get transactionHash(): Bytes { - let value = this.get("transactionHash"); - if (!value || value.kind == ValueKind.NULL) { - throw new Error("Cannot return null for a required field."); - } else { - return value.toBytes(); - } - } - - set transactionHash(value: Bytes) { - this.set("transactionHash", Value.fromBytes(value)); - } -} diff --git a/packages/subgraph/manifest/data/devnet.json b/packages/subgraph/manifest/data/devnet.json index d315bcb6..1ba75e5b 100644 --- a/packages/subgraph/manifest/data/devnet.json +++ b/packages/subgraph/manifest/data/devnet.json @@ -27,6 +27,16 @@ "address": "0xcAE5A9f266991dcEdc62bb9291f15E112f212820", "startBlock": 1 }, + "LoyaltyBurner": { + "name": "LoyaltyBurner", + "address": "0x5B4f8F9566706D4dB7f5E3020cE0485f96415749", + "startBlock": 1 + }, + "LoyaltyBridge": { + "name": "LoyaltyBridge", + "address": "0xd73e6a2f2e47236F1Ff737E72497f598652122F9", + "startBlock": 1 + }, "Shop": { "name": "Shop", "address": "0xB4B0d4D6aAd2f963CC2FaeCBb4B8C94C3eeE6DB8", diff --git a/packages/subgraph/manifest/subgraph.placeholder.yaml b/packages/subgraph/manifest/subgraph.placeholder.yaml index 439fbd61..6cb56905 100644 --- a/packages/subgraph/manifest/subgraph.placeholder.yaml +++ b/packages/subgraph/manifest/subgraph.placeholder.yaml @@ -127,6 +127,54 @@ dataSources: handler: handleTransferredLoyaltyToken file: ./src/ledger.ts + - kind: ethereum + name: {{dataSources.LoyaltyBurner.name}} + network: {{network}} + source: + address: '{{dataSources.LoyaltyBurner.address}}' + abi: LoyaltyBurner + startBlock: {{dataSources.LoyaltyBurner.startBlock}} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - BurnedPoint + - BurnedUnPayablePoint + abis: + - name: LoyaltyBurner + file: $DMS_OSX_MODULE/artifacts/contracts/controllers/LoyaltyBurner.sol/LoyaltyBurner.json + eventHandlers: + - event: BurnedPoint(address,uint256,uint256) + handler: handleBurnedPoint + - event: BurnedUnPayablePoint(bytes32,uint256,uint256) + handler: handleBurnedUnPayablePoint + file: ./src/ledger.ts + + - kind: ethereum + name: {{dataSources.LoyaltyBridge.name}} + network: {{network}} + source: + address: '{{dataSources.LoyaltyBridge.address}}' + abi: LoyaltyBridge + startBlock: {{dataSources.LoyaltyBridge.startBlock}} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - BridgeDeposited + - BridgeWithdrawn + abis: + - name: LoyaltyBridge + file: $DMS_OSX_MODULE/artifacts/contracts/controllers/LoyaltyBridge.sol/LoyaltyBridge.json + eventHandlers: + - event: BridgeDeposited(bytes32,address,uint256,uint256) + handler: handleBridgeDeposited + - event: BridgeWithdrawn(bytes32,address,uint256,uint256) + handler: handleBridgeWithdrawn + file: ./src/ledger.ts + - kind: ethereum name: {{dataSources.Shop.name}} network: {{network}} diff --git a/packages/subgraph/schema.graphql b/packages/subgraph/schema.graphql index 76fda7a4..3b4992ba 100644 --- a/packages/subgraph/schema.graphql +++ b/packages/subgraph/schema.graphql @@ -133,3 +133,45 @@ type ShopWithdraw @entity { blockTimestamp: BigInt! transactionHash: Bytes! } + +type BurnedPoint @entity(immutable: true) { + id: Bytes! + account: Bytes! # address + amount: BigInt! # uint256 + balance: BigInt! # uint256 + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} + +type BurnedUnPayablePoint @entity(immutable: true) { + id: Bytes! + phone: Bytes! # bytes32 + amount: BigInt! # uint256 + balance: BigInt! # uint256 + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} + +type BridgeDeposited @entity(immutable: true) { + id: Bytes! + depositId: Bytes! # bytes32 + account: Bytes! # address + amount: BigInt! # uint256 + balance: BigInt! # uint256 + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} + +type BridgeWithdrawn @entity(immutable: true) { + id: Bytes! + withdrawId: Bytes! # bytes32 + account: Bytes! # address + amount: BigInt! # uint256 + balance: BigInt! # uint256 + blockNumber: BigInt! + blockTimestamp: BigInt! + transactionHash: Bytes! +} diff --git a/packages/subgraph/src/ledger.ts b/packages/subgraph/src/ledger.ts index 8c116c63..308efd47 100644 --- a/packages/subgraph/src/ledger.ts +++ b/packages/subgraph/src/ledger.ts @@ -1,3 +1,5 @@ +import { BigInt, Bytes } from "@graphprotocol/graph-ts"; +import { AmountUnit, NullBytes32 } from "./utils"; import { Deposited as DepositedEvent, ProvidedPoint as ProvidedPointEvent, @@ -15,16 +17,25 @@ import { ChangedToPayablePoint as ChangedToPayablePointEvent, } from "../generated/LoyaltyExchanger/LoyaltyExchanger"; import { TransferredLoyaltyToken as TransferredLoyaltyTokenEvent } from "../generated/LoyaltyTransfer/LoyaltyTransfer"; +import { + BridgeDeposited as BridgeDepositedEvent, + BridgeWithdrawn as BridgeWithdrawnEvent, +} from "../generated/LoyaltyBridge/LoyaltyBridge"; +import { + BurnedPoint as BurnedPointEvent, + BurnedUnPayablePoint as BurnedUnPayablePointEvent, +} from "../generated/LoyaltyBurner/LoyaltyBurner"; import { SavedPurchase, UserBalance, UserTradeHistory, UserUnPayableTradeHistory, LoyaltyPaymentEvent, + BridgeDeposited, + BridgeWithdrawn, + BurnedPoint, + BurnedUnPayablePoint, } from "../generated/schema"; -import { BigInt, Bytes } from "@graphprotocol/graph-ts"; -import { AmountUnit, NullBytes32 } from "./utils"; -import { TransferredLoyaltyToken } from "../generated/LoyaltyTransfer/LoyaltyTransfer"; enum PageType { NONE = 0, @@ -52,6 +63,7 @@ enum UserAction { NONE = 0, SAVED = 1, USED = 2, + BURNED, DEPOSITED = 11, WITHDRAWN = 12, CHANGED = 21, @@ -60,87 +72,7 @@ enum UserAction { OUT = 42, } -export function handleSavedPurchase(event: SavedPurchaseEvent): void { - let entity = new SavedPurchase(event.transaction.hash.concatI32(event.logIndex.toI32())); - entity.purchaseId = event.params.purchaseId; - entity.amount = event.params.amount.div(AmountUnit); - entity.loyalty = event.params.loyalty.div(AmountUnit); - entity.currency = event.params.currency; - entity.shopId = event.params.shopId; - entity.account = event.params.account; - entity.phone = event.params.phone; - - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - - entity.save(); -} - -export function handleProvidedUnPayablePoint(event: ProvidedUnPayablePointEvent): void { - handleProvidedForUnPayablePointHistory(event); -} - -export function handleChangedToPayablePoint(event: ChangedToPayablePointEvent): void { - handleChangedPointForHistory(event); - handleChangedPointForUnPayablePointHistory(event); -} - -export function handleChangedToLoyaltyToken(event: ChangedToLoyaltyTokenEvent): void { - handleChangedToLoyaltyTokenForHistory(event); -} - -export function handleProvidedPoint(event: ProvidedPointEvent): void { - handleProvidedPointForHistory(event); -} - -export function handleProvidedToken(event: ProvidedTokenEvent): void { - handleProvidedTokenForHistory(event); -} - -export function handleLoyaltyPaymentEvent(event: LoyaltyPaymentEventEvent): void { - let entity = new LoyaltyPaymentEvent(event.transaction.hash.concatI32(event.logIndex.toI32())); - entity.paymentId = event.params.payment.paymentId; - entity.purchaseId = event.params.payment.purchaseId; - entity.currency = event.params.payment.currency; - entity.shopId = event.params.payment.shopId; - entity.account = event.params.payment.account; - entity.timestamp = event.params.payment.timestamp; - entity.loyaltyType = event.params.payment.loyaltyType; - entity.paidPoint = event.params.payment.paidPoint; - entity.paidToken = event.params.payment.paidToken; - entity.paidValue = event.params.payment.paidValue; - entity.feePoint = event.params.payment.feePoint; - entity.feeToken = event.params.payment.feeToken; - entity.feeValue = event.params.payment.feeValue; - entity.status = event.params.payment.status; - entity.balance = event.params.balance; - - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - - entity.save(); - - handleLoyaltyPaymentEventForHistory(event); -} - -export function handleProvidedTokenForSettlement(event: ProvidedTokenForSettlementEvent): void { - handleSettlementForHistory(event); -} - -export function handleDeposited(event: DepositedEvent): void { - handleDepositedForHistory(event); -} - -export function handleWithdrawn(event: WithdrawnEvent): void { - handleWithdrawnForHistory(event); -} - -export function handleTransferredLoyaltyToken(event: TransferredLoyaltyTokenEvent): void { - handleTransferredLoyaltyTokenForHistory(event); -} - +// region UserBalance export function handleChangedBalancePoint( account: Bytes, balance: BigInt, @@ -193,6 +125,18 @@ export function handleChangedBalanceToken( return entity; } +// endregion + +// region Ledger + +export function handleDeposited(event: DepositedEvent): void { + handleDepositedForHistory(event); +} + +export function handleWithdrawn(event: WithdrawnEvent): void { + handleWithdrawnForHistory(event); +} + export function handleDepositedForHistory(event: DepositedEvent): void { const balanceEntity = handleChangedBalanceToken( event.params.account, @@ -245,51 +189,15 @@ export function handleWithdrawnForHistory(event: WithdrawnEvent): void { entity.save(); } -export function handleSettlementForHistory(event: ProvidedTokenForSettlementEvent): void { - const balanceEntity = handleChangedBalanceToken( - event.params.account, - event.params.balanceToken, - event.block.number, - event.block.timestamp, - event.transaction.hash - ); - let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); - entity.account = event.params.account; - entity.pageType = PageType.NONE; - entity.action = UserAction.SETTLEMENT; - entity.cancel = false; - entity.loyaltyType = LoyaltyType.TOKEN; - entity.amountPoint = event.params.providedPoint.div(AmountUnit); - entity.amountToken = event.params.providedToken.div(AmountUnit); - entity.amountValue = event.params.providedPoint.div(AmountUnit); - entity.currency = event.params.currency; - entity.balanceToken = event.params.balanceToken.div(AmountUnit); - entity.balancePoint = balanceEntity.point; - entity.purchaseId = event.params.purchaseId; - entity.shopId = event.params.shopId; - - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - entity.save(); -} +// endregion -export function handleProvidedForUnPayablePointHistory(event: ProvidedUnPayablePointEvent): void { - let entity = new UserUnPayableTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); - entity.phone = event.params.phone; - entity.action = UserAction.SAVED; - entity.amount = event.params.providedPoint.div(AmountUnit); - entity.balance = event.params.balancePoint.div(AmountUnit); - entity.purchaseId = event.params.purchaseId; - entity.shopId = event.params.shopId; +// region LoyaltyExchanger - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - entity.save(); +export function handleChangedToPayablePoint(event: ChangedToPayablePointEvent): void { + handleChangedPointForHistory(event); + handleChangedPointForUnPayablePointForHistory(event); } - -export function handleChangedPointForUnPayablePointHistory(event: ChangedToPayablePointEvent): void { +export function handleChangedPointForUnPayablePointForHistory(event: ChangedToPayablePointEvent): void { let entity = new UserUnPayableTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); entity.phone = event.params.phone; entity.action = UserAction.CHANGED; @@ -328,6 +236,108 @@ export function handleChangedPointForHistory(event: ChangedToPayablePointEvent): entity.save(); } +export function handleChangedToLoyaltyToken(event: ChangedToLoyaltyTokenEvent): void { + handleChangedToLoyaltyTokenForHistory(event); +} +export function handleChangedToLoyaltyTokenForHistory(event: ChangedToLoyaltyTokenEvent): void { + let balanceEntity = handleChangedBalancePoint( + event.params.account, + BigInt.fromI32(0), + event.block.number, + event.block.timestamp, + event.transaction.hash + ); + + let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.account; + entity.pageType = PageType.SAVE_USE; + entity.action = UserAction.CHANGED; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.POINT; + entity.amountPoint = event.params.amountPoint.div(AmountUnit); + entity.amountToken = BigInt.fromI32(0); + entity.amountValue = event.params.amountPoint.div(AmountUnit); + entity.balancePoint = BigInt.fromI32(0); + entity.balanceToken = balanceEntity.token; + entity.purchaseId = ""; + entity.paymentId = NullBytes32; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); + + entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.account; + entity.pageType = PageType.SAVE_USE; + entity.action = UserAction.CHANGED; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.TOKEN; + entity.amountPoint = BigInt.fromI32(0); + entity.amountToken = event.params.amountToken.div(AmountUnit); + entity.amountValue = event.params.amountPoint.div(AmountUnit); + entity.balancePoint = BigInt.fromI32(0); + entity.balanceToken = event.params.balanceToken.div(AmountUnit); + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); +} + +// endregion + +// region LoyaltyProvider + +export function handleSavedPurchase(event: SavedPurchaseEvent): void { + let entity = new SavedPurchase(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.purchaseId = event.params.purchaseId; + entity.amount = event.params.amount.div(AmountUnit); + entity.loyalty = event.params.loyalty.div(AmountUnit); + entity.currency = event.params.currency; + entity.shopId = event.params.shopId; + entity.account = event.params.account; + entity.phone = event.params.phone; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + + entity.save(); +} + +export function handleProvidedUnPayablePoint(event: ProvidedUnPayablePointEvent): void { + handleProvidedForUnPayablePointForHistory(event); +} + +export function handleProvidedPoint(event: ProvidedPointEvent): void { + handleProvidedPointForHistory(event); +} + +export function handleProvidedToken(event: ProvidedTokenEvent): void { + handleProvidedTokenForHistory(event); +} + +export function handleProvidedTokenForSettlement(event: ProvidedTokenForSettlementEvent): void { + handleSettlementForHistory(event); +} + +export function handleProvidedForUnPayablePointForHistory(event: ProvidedUnPayablePointEvent): void { + let entity = new UserUnPayableTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.phone = event.params.phone; + entity.action = UserAction.SAVED; + entity.amount = event.params.providedPoint.div(AmountUnit); + entity.balance = event.params.balancePoint.div(AmountUnit); + entity.purchaseId = event.params.purchaseId; + entity.shopId = event.params.shopId; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); +} + export function handleProvidedPointForHistory(event: ProvidedPointEvent): void { const balanceEntity = handleChangedBalancePoint( event.params.account, @@ -349,6 +359,7 @@ export function handleProvidedPointForHistory(event: ProvidedPointEvent): void { entity.balancePoint = event.params.balancePoint.div(AmountUnit); entity.balanceToken = balanceEntity.token; entity.purchaseId = event.params.purchaseId; + entity.paymentId = NullBytes32; entity.shopId = event.params.shopId; entity.blockNumber = event.block.number; @@ -378,6 +389,7 @@ export function handleProvidedTokenForHistory(event: ProvidedTokenEvent): void { entity.balanceToken = event.params.balanceToken.div(AmountUnit); entity.balancePoint = balanceEntity.point; entity.purchaseId = event.params.purchaseId; + entity.paymentId = NullBytes32; entity.shopId = event.params.shopId; entity.blockNumber = event.block.number; @@ -386,50 +398,134 @@ export function handleProvidedTokenForHistory(event: ProvidedTokenEvent): void { entity.save(); } -export function handleChangedToLoyaltyTokenForHistory(event: ChangedToLoyaltyTokenEvent): void { - let balanceEntity = handleChangedBalancePoint( +export function handleSettlementForHistory(event: ProvidedTokenForSettlementEvent): void { + const balanceEntity = handleChangedBalanceToken( event.params.account, - BigInt.fromI32(0), + event.params.balanceToken, event.block.number, event.block.timestamp, event.transaction.hash ); - let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); entity.account = event.params.account; - entity.pageType = PageType.SAVE_USE; - entity.action = UserAction.CHANGED; + entity.pageType = PageType.NONE; + entity.action = UserAction.SETTLEMENT; entity.cancel = false; - entity.loyaltyType = LoyaltyType.POINT; - entity.amountPoint = event.params.amountPoint.div(AmountUnit); - entity.amountToken = BigInt.fromI32(0); - entity.amountValue = event.params.amountPoint.div(AmountUnit); - entity.balancePoint = BigInt.fromI32(0); - entity.balanceToken = balanceEntity.token; - entity.purchaseId = ""; - entity.shopId = NullBytes32; - - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; + entity.loyaltyType = LoyaltyType.TOKEN; + entity.amountPoint = event.params.providedPoint.div(AmountUnit); + entity.amountToken = event.params.providedToken.div(AmountUnit); + entity.amountValue = event.params.providedPoint.div(AmountUnit); + entity.currency = event.params.currency; + entity.balanceToken = event.params.balanceToken.div(AmountUnit); + entity.balancePoint = balanceEntity.point; + entity.purchaseId = event.params.purchaseId; + entity.paymentId = NullBytes32; + entity.shopId = event.params.shopId; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; entity.transactionHash = event.transaction.hash; entity.save(); +} - entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); - entity.account = event.params.account; - entity.pageType = PageType.SAVE_USE; - entity.action = UserAction.CHANGED; - entity.cancel = false; - entity.loyaltyType = LoyaltyType.TOKEN; - entity.amountPoint = BigInt.fromI32(0); - entity.amountToken = event.params.amountToken.div(AmountUnit); - entity.amountValue = event.params.amountPoint.div(AmountUnit); - entity.balancePoint = BigInt.fromI32(0); - entity.balanceToken = event.params.balanceToken.div(AmountUnit); +// endregion + +// region LoyaltyTransfer +export function handleTransferredLoyaltyToken(event: TransferredLoyaltyTokenEvent): void { + handleTransferredLoyaltyTokenForHistory(event); +} + +export function handleTransferredLoyaltyTokenForHistory(event: TransferredLoyaltyTokenEvent): void { + { + const balanceEntity = handleChangedBalanceToken( + event.params.from, + event.params.balanceOfFrom, + event.block.number, + event.block.timestamp, + event.transaction.hash + ); + + let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.from; + entity.pageType = PageType.TRANSFER; + entity.action = UserAction.OUT; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.TOKEN; + entity.amountPoint = BigInt.fromI32(0); + entity.amountToken = event.params.amount.div(AmountUnit); + entity.amountValue = BigInt.fromI32(0); + entity.currency = "TOKEN"; + entity.balanceToken = balanceEntity.token; + entity.balancePoint = balanceEntity.point; + entity.purchaseId = ""; + entity.paymentId = NullBytes32; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); + } + + { + const balanceEntity = handleChangedBalanceToken( + event.params.to, + event.params.balanceOfTo, + event.block.number, + event.block.timestamp, + event.transaction.hash + ); + + let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32() + 1)); + entity.account = event.params.to; + entity.pageType = PageType.TRANSFER; + entity.action = UserAction.IN; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.TOKEN; + entity.amountPoint = BigInt.fromI32(0); + entity.amountToken = event.params.amount.div(AmountUnit); + entity.amountValue = BigInt.fromI32(0); + entity.currency = "TOKEN"; + entity.balanceToken = balanceEntity.token; + entity.balancePoint = balanceEntity.point; + entity.purchaseId = ""; + entity.paymentId = NullBytes32; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); + } +} +// endregion + +// region LoyaltyConsumer +export function handleLoyaltyPaymentEvent(event: LoyaltyPaymentEventEvent): void { + let entity = new LoyaltyPaymentEvent(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.paymentId = event.params.payment.paymentId; + entity.purchaseId = event.params.payment.purchaseId; + entity.currency = event.params.payment.currency; + entity.shopId = event.params.payment.shopId; + entity.account = event.params.payment.account; + entity.timestamp = event.params.payment.timestamp; + entity.loyaltyType = event.params.payment.loyaltyType; + entity.paidPoint = event.params.payment.paidPoint; + entity.paidToken = event.params.payment.paidToken; + entity.paidValue = event.params.payment.paidValue; + entity.feePoint = event.params.payment.feePoint; + entity.feeToken = event.params.payment.feeToken; + entity.feeValue = event.params.payment.feeValue; + entity.status = event.params.payment.status; + entity.balance = event.params.balance; entity.blockNumber = event.block.number; entity.blockTimestamp = event.block.timestamp; entity.transactionHash = event.transaction.hash; + entity.save(); + + handleLoyaltyPaymentEventForHistory(event); } export function handleLoyaltyPaymentEventForHistory(event: LoyaltyPaymentEventEvent): void { @@ -466,7 +562,7 @@ export function handlePaidPointForHistory(event: LoyaltyPaymentEventEvent): void entity.amountToken = BigInt.fromI32(0); entity.amountValue = event.params.payment.paidValue.div(AmountUnit); entity.currency = event.params.payment.currency; - entity.balancePoint = event.params.balance.div(AmountUnit); + entity.balancePoint = balanceEntity.point; entity.balanceToken = balanceEntity.token; entity.purchaseId = event.params.payment.purchaseId; entity.paymentId = event.params.payment.paymentId; @@ -496,7 +592,7 @@ export function handlePaidTokenForHistory(event: LoyaltyPaymentEventEvent): void entity.amountToken = event.params.payment.paidToken.div(AmountUnit); entity.amountValue = event.params.payment.paidValue.div(AmountUnit); entity.currency = event.params.payment.currency; - entity.balanceToken = event.params.balance.div(AmountUnit); + entity.balanceToken = balanceEntity.token; entity.balancePoint = balanceEntity.point; entity.purchaseId = event.params.payment.purchaseId; entity.paymentId = event.params.payment.paymentId; @@ -526,7 +622,7 @@ export function handleCanceledPointForHistory(event: LoyaltyPaymentEventEvent): entity.amountToken = BigInt.fromI32(0); entity.amountValue = event.params.payment.paidValue.div(AmountUnit); entity.currency = event.params.payment.currency; - entity.balancePoint = event.params.balance.div(AmountUnit); + entity.balancePoint = balanceEntity.point; entity.balanceToken = balanceEntity.token; entity.purchaseId = event.params.payment.purchaseId; entity.paymentId = event.params.payment.paymentId; @@ -556,7 +652,7 @@ export function handleCanceledTokenForHistory(event: LoyaltyPaymentEventEvent): entity.amountToken = event.params.payment.paidToken.div(AmountUnit); entity.amountValue = event.params.payment.paidValue.div(AmountUnit); entity.currency = event.params.payment.currency; - entity.balanceToken = event.params.balance.div(AmountUnit); + entity.balanceToken = balanceEntity.token; entity.balancePoint = balanceEntity.point; entity.purchaseId = event.params.payment.purchaseId; entity.paymentId = event.params.payment.paymentId; @@ -568,66 +664,175 @@ export function handleCanceledTokenForHistory(event: LoyaltyPaymentEventEvent): entity.save(); } -export function handleTransferredLoyaltyTokenForHistory(event: TransferredLoyaltyTokenEvent): void { - { - const balanceEntity = handleChangedBalanceToken( - event.params.from, - event.params.balanceOfFrom, - event.block.number, - event.block.timestamp, - event.transaction.hash - ); +// endregion - let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); - entity.account = event.params.from; - entity.pageType = PageType.TRANSFER; - entity.action = UserAction.OUT; - entity.cancel = false; - entity.loyaltyType = LoyaltyType.TOKEN; - entity.amountPoint = BigInt.fromI32(0); - entity.amountToken = event.params.amount.div(AmountUnit); - entity.amountValue = BigInt.fromI32(0); - entity.currency = "kios"; - entity.balanceToken = event.params.balanceOfFrom; - entity.balancePoint = balanceEntity.point; - entity.purchaseId = ""; - entity.paymentId = NullBytes32; - entity.shopId = NullBytes32; +// region LoyaltyBurner +export function handleBurnedPoint(event: BurnedPointEvent): void { + let entity = new BurnedPoint(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.account; + entity.amount = event.params.amount; - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - entity.save(); - } + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; - { - const balanceEntity = handleChangedBalanceToken( - event.params.to, - event.params.balanceOfTo, - event.block.number, - event.block.timestamp, - event.transaction.hash - ); + entity.save(); - let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32() + 1)); - entity.account = event.params.to; - entity.pageType = PageType.TRANSFER; - entity.action = UserAction.IN; - entity.cancel = false; - entity.loyaltyType = LoyaltyType.TOKEN; - entity.amountPoint = BigInt.fromI32(0); - entity.amountToken = event.params.amount.div(AmountUnit); - entity.amountValue = BigInt.fromI32(0); - entity.currency = "kios"; - entity.balanceToken = event.params.balanceOfTo; - entity.balancePoint = balanceEntity.point; - entity.purchaseId = ""; - entity.paymentId = NullBytes32; - entity.shopId = NullBytes32; + handleBurnedPointForHistory(event); +} - entity.blockNumber = event.block.number; - entity.blockTimestamp = event.block.timestamp; - entity.transactionHash = event.transaction.hash; - entity.save(); - } +export function handleBurnedPointForHistory(event: BurnedPointEvent): void { + const balanceEntity = handleChangedBalancePoint( + event.params.account, + event.params.balance, + event.block.number, + event.block.timestamp, + event.transaction.hash + ); + + let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.account; + entity.pageType = PageType.SAVE_USE; + entity.action = UserAction.BURNED; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.POINT; + entity.amountPoint = BigInt.fromI32(0); + entity.amountToken = event.params.amount.div(AmountUnit); + entity.amountValue = BigInt.fromI32(0); + entity.balanceToken = balanceEntity.token; + entity.balancePoint = balanceEntity.point; + entity.purchaseId = ""; + entity.paymentId = NullBytes32; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); } + +export function handleBurnedUnPayablePoint(event: BurnedUnPayablePointEvent): void { + let entity = new BurnedUnPayablePoint(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.phone = event.params.phone; + entity.amount = event.params.amount; + entity.balance = event.params.balance; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + + entity.save(); +} + +export function handleBurnedUnPayablePointForHistory(event: BurnedUnPayablePointEvent): void { + let entity = new UserUnPayableTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.phone = event.params.phone; + entity.action = UserAction.BURNED; + entity.amount = event.params.amount.div(AmountUnit); + entity.balance = event.params.balance.div(AmountUnit); + entity.purchaseId = ""; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); +} + +// endregion + +// region LoyaltyBridge + +export function handleBridgeDeposited(event: BridgeDepositedEvent): void { + let entity = new BridgeDeposited(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.depositId = event.params.depositId; + entity.account = event.params.account; + entity.amount = event.params.amount; + entity.balance = event.params.balance; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + + entity.save(); + + handleBridgeDepositedForHistory(event); +} + +export function handleBridgeDepositedForHistory(event: BridgeDepositedEvent): void { + const balanceEntity = handleChangedBalanceToken( + event.params.account, + event.params.balance, + event.block.number, + event.block.timestamp, + event.transaction.hash + ); + + let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.account; + entity.pageType = PageType.DEPOSIT_WITHDRAW; + entity.action = UserAction.WITHDRAWN; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.TOKEN; + entity.amountPoint = BigInt.fromI32(0); + entity.amountToken = event.params.amount.div(AmountUnit); + entity.amountValue = BigInt.fromI32(0); + entity.balanceToken = balanceEntity.token; + entity.balancePoint = balanceEntity.point; + entity.purchaseId = ""; + entity.paymentId = NullBytes32; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); +} + +export function handleBridgeWithdrawn(event: BridgeWithdrawnEvent): void { + let entity = new BridgeWithdrawn(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.withdrawId = event.params.withdrawId; + entity.account = event.params.account; + entity.amount = event.params.amount; + entity.balance = event.params.balance; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + + entity.save(); + + handleBridgeWithdrawnForHistory(event); +} + +export function handleBridgeWithdrawnForHistory(event: BridgeWithdrawnEvent): void { + const balanceEntity = handleChangedBalanceToken( + event.params.account, + event.params.balance, + event.block.number, + event.block.timestamp, + event.transaction.hash + ); + + let entity = new UserTradeHistory(event.transaction.hash.concatI32(event.logIndex.toI32())); + entity.account = event.params.account; + entity.pageType = PageType.DEPOSIT_WITHDRAW; + entity.action = UserAction.DEPOSITED; + entity.cancel = false; + entity.loyaltyType = LoyaltyType.TOKEN; + entity.amountPoint = BigInt.fromI32(0); + entity.amountToken = event.params.amount.div(AmountUnit); + entity.amountValue = BigInt.fromI32(0); + entity.balanceToken = balanceEntity.token; + entity.balancePoint = balanceEntity.point; + entity.purchaseId = ""; + entity.paymentId = NullBytes32; + entity.shopId = NullBytes32; + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + entity.transactionHash = event.transaction.hash; + entity.save(); +} + +// endregion diff --git a/packages/validator/package.json b/packages/validator/package.json index a83beb7a..7cae1c36 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -74,7 +74,7 @@ "chai-http": "^4.3.7", "cors": "^2.8.5", "del-osx-artifacts": "^2.2.0", - "dms-osx-artifacts": "^2.7.3", + "dms-osx-artifacts": "^2.7.5", "dms-store-purchase-contracts": "^1.0.2", "dms-store-purchase-sdk": "^1.3.0", "dom-parser": "^1.1.5",