-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04-at-block-removed.js
More file actions
35 lines (31 loc) · 1.03 KB
/
04-at-block-removed.js
File metadata and controls
35 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SIP-042: at-block removed
// Attempts to deploy a Clarity 5 contract that uses at-block.
// Should fail during analysis with UnknownFunction("at-block").
// The deploy tx should be included in the block but fail, and the fee is collected.
const {
makeContractDeploy,
ClarityVersion,
PostConditionMode,
} = require("@stacks/transactions");
const { PRIVATE_KEY, NETWORK } = require("./config");
const { broadcast } = require("./broadcast");
const codeBody = `
;; This contract should fail to deploy in epoch 3.4
;; because at-block is removed from Clarity 5
(define-read-only (get-old-height (block-hash (buff 32)))
(at-block block-hash block-height)
)
`;
async function main() {
const tx = await makeContractDeploy({
codeBody,
contractName: "at-block-removed-test",
clarityVersion: ClarityVersion.Clarity5,
senderKey: PRIVATE_KEY,
network: NETWORK,
fee: 50000,
postConditionMode: PostConditionMode.Deny,
});
await broadcast(tx, "SIP-042: at-block removal (expect failure)");
}
main().catch(console.error);