-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update handler logic and event templating
- Loading branch information
Showing
4 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"_format": "hh-sol-artifact-1", | ||
"contractName": "MinPriceLib", | ||
"sourceName": "contracts/libs/v0.8.x/minter-libs/MinPriceLib.sol", | ||
"abi": [ | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "defaultMintFee", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "DefaultMintFeeUpdated", | ||
"type": "event" | ||
} | ||
], | ||
"bytecode": "0x60566037600b82828239805160001a607314602a57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203f3c50a0befcee8c62454a866b00f1cb35d917b564e88c2758a433ea6d7c872164736f6c63430008160033", | ||
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212203f3c50a0befcee8c62454a866b00f1cb35d917b564e88c2758a433ea6d7c872164736f6c63430008160033", | ||
"linkReferences": {}, | ||
"deployedLinkReferences": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { DefaultMintFeeUpdated } from "../generated/MinPriceLib/MinPriceLib"; | ||
import { loadOrCreateMinter } from "./helpers"; | ||
import { setMinterExtraMinterDetailsValue } from "./extra-minter-details-helpers"; | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// EVENT HANDLERS start here | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* Handles the update of contract-level default mint fee. | ||
* Loads or creates the minter, updates the minter's extra minter details with | ||
* the updated value, and induces a sync of the minter entity. | ||
* @param event The event carrying new default mint fee value. | ||
*/ | ||
export function handleDefaultMintFeeUpdated( | ||
event: DefaultMintFeeUpdated | ||
): void { | ||
// load minter | ||
const minter = loadOrCreateMinter(event.address, event.block.timestamp); | ||
|
||
// update minter entity | ||
setMinterExtraMinterDetailsValue( | ||
"defaultMintFee", | ||
event.params.defaultMintFee.toString(), | ||
minter | ||
); | ||
|
||
// update minter's updatedAt timestamp to induce a sync, and save | ||
minter.updatedAt = event.block.timestamp; | ||
minter.save(); | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// EVENT HANDLERS end here | ||
/////////////////////////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters