-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into align-error-message-tests
- Loading branch information
Showing
14 changed files
with
259 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Sepolia Deployment | ||
|
||
GiftFactory classhash: 0x6240992fd28e14bf2757a2b7320831220ffa7816cf962403b13f94aec95d7da | ||
GiftFactory address: 0x7e0f5a5364e197200461a18d695082848b3d4d1e90d3349492263f4c913ae3c | ||
EscrowAccount class hash: 0x4e2ac27f56cf97077cf43788c831acdc8734e447a5ec676e93101b9dd22eace | ||
EscrowLibrary class hash: 0x4ee1fc3650c515e0c30705c326dbda34a07ebe32bddf39be43b5110dd4ead16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { logTransactionJson } from "./json_tx_builder"; | ||
|
||
/// To use this script, fill in the following value: | ||
/// - factoryAddress: the address of the factory contract | ||
|
||
const factoryAddress = ""; | ||
|
||
if (!factoryAddress) { | ||
throw new Error("Factory contract address is not set. Please set it in the script file."); | ||
} | ||
|
||
const tx = { | ||
contractAddress: factoryAddress, | ||
entrypoint: "cancel_upgrade", | ||
calldata: [], | ||
}; | ||
|
||
logTransactionJson([tx]); |
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,43 @@ | ||
import { CallData } from "starknet"; | ||
import { calculateEscrowAddress } from "../lib"; | ||
import { Gift, buildGiftCallData, executeActionOnAccount } from "../lib/claim"; | ||
import { logTransactionJson } from "./json_tx_builder"; | ||
|
||
/// To use this script, fill in the following value: | ||
/// - factoryAddress: the address of the factory contract | ||
/// - dustReceiver: the address of the dust receiver | ||
/// - claim: the claim object | ||
|
||
const factoryAddress = ""; | ||
const dustReceiver = ""; | ||
const claim: Gift = { | ||
factory: factoryAddress, | ||
escrow_class_hash: "", | ||
sender: "", | ||
gift_token: "", | ||
gift_amount: 0n, | ||
fee_token: "", | ||
fee_amount: 0n, | ||
gift_pubkey: 0n, | ||
}; | ||
|
||
if (!factoryAddress) { | ||
throw new Error("Factory contract address is not set. Please set it in the script file."); | ||
} | ||
|
||
if (!dustReceiver) { | ||
throw new Error("Dust receiver address is not set. Please set it in the script file."); | ||
} | ||
|
||
for (const key in claim) { | ||
if (key in claim && !claim[key as keyof typeof claim] && key !== "fee_amount" && key !== "gift_amount") { | ||
throw new Error(`The property ${key} is empty in the claim object.`); | ||
} | ||
} | ||
|
||
const tx = executeActionOnAccount( | ||
"claim_dust", | ||
calculateEscrowAddress(claim), | ||
CallData.compile([(buildGiftCallData(claim), dustReceiver)]), | ||
); | ||
logTransactionJson([tx]); |
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,15 @@ | ||
import { num } from "starknet"; | ||
import { manager, protocolCache, setupGiftProtocol } from "../lib"; | ||
|
||
const { factory, escrowAccountClassHash, escrowLibraryClassHash } = await setupGiftProtocol(); | ||
|
||
console.log("GiftFactory classhash:", await manager.getClassHashAt(factory.address)); | ||
console.log("GiftFactory address:", factory.address); | ||
console.log("GiftFactory owner:", num.toHex(await factory.owner())); | ||
console.log("EscrowAccount class hash:", escrowAccountClassHash); | ||
console.log("EscrowLibrary class hash:", escrowLibraryClassHash); | ||
|
||
// clear from cache just in case | ||
delete protocolCache["GiftFactory"]; | ||
delete protocolCache["EscrowLibrary"]; | ||
delete protocolCache["EscrowAccount"]; |
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,5 @@ | ||
import { Call } from "starknet"; | ||
|
||
export function logTransactionJson(transaction: Call[]) { | ||
console.log(JSON.stringify(transaction, null, 2)); | ||
} |
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,18 @@ | ||
import { logTransactionJson } from "./json_tx_builder"; | ||
|
||
/// To use this script, fill in the following value: | ||
/// - factoryAddress: the address of the factory contract | ||
|
||
const factoryAddress = ""; | ||
|
||
if (!factoryAddress) { | ||
throw new Error("Factory contract address is not set. Please set it in the script file."); | ||
} | ||
|
||
const tx = { | ||
contractAddress: factoryAddress, | ||
entrypoint: "pause", | ||
calldata: [], | ||
}; | ||
|
||
logTransactionJson([tx]); |
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
Oops, something went wrong.