@openzeppelin/wizard-stellar 0.3.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,129 +1,13 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.zipScaffold = zipScaffold;
7
- const jszip_1 = __importDefault(require("jszip"));
8
- const print_1 = require("./print");
9
- const version_1 = require("./utils/version");
10
- const zip_shared_1 = require("./zip-shared");
11
- function getAddressArgs(c) {
12
- return c.constructorArgs
13
- .filter(constructorArg => { var _a; return ((_a = constructorArg.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'address'; })
14
- .map(constructorArg => constructorArg.name);
15
- }
16
- const setupSh = (c, opts, scaffoldContractName) => {
17
- const environmentsFileUpdate = (setUpContract, setUpScaffoldContractName) => `
18
- # Update environments.toml: remove original contracts and insert wizard's contract
19
- setup_environment() {
20
- local file="environments.toml"
21
- local temp
22
- temp="$(mktemp)"
23
-
24
- local in_dev_contracts=0
25
- local skip_entry=0
26
- local contract_entry_inserted=0
27
- insert_contract_entry() {
28
- {
29
- printf '%s\\n' "[development.contracts.${setUpScaffoldContractName}_contract]" \\
30
- "client = true" "" \\
31
- "# If your contract has a \\\`__constructor\\\`, specify your arguments to it here." \\
32
- "# These are the same arguments you could pass after the \\\`--\\\` in a call to" \\
33
- "# \\\`stellar contract deploy\\\`" \\
34
- "# Only available in \\\`development\\\` and \\\`test\\\` environments" \\
35
- ${setUpContract.constructorArgs.length
36
- ? // Mind the spacing
37
- `"# TODO add appropriate values for for the constructors arguments" \\
38
- "constructor_args = \\"\\"\\"" \\
39
- "${setUpContract.constructorArgs.map(constructorArg => { var _a; return `--${constructorArg.name} \\"ADD_${constructorArg.name.toLocaleUpperCase()}_${((_a = constructorArg.type) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase()) || 'ARGUMENT'}_HERE\\"`; }).join(' ')}" \\
40
- "\\"\\"\\"" \\
41
- ""`
42
- : '""'}
43
- } >> "$temp"
44
- }
45
-
46
- while IFS= read -r line; do
47
- if [[ $contract_entry_inserted -eq 0 && $line == '[staging.network]' ]]; then
48
- insert_contract_entry
49
- contract_entry_inserted=1
50
- fi
51
-
52
- if [[ $line =~ ^\\[development\\.contracts\\]$ ]]; then
53
- printf '%s\\n' "$line" >> "$temp"
54
- in_dev_contracts=1
55
- skip_entry=0
56
- continue
57
- fi
58
-
59
- if [[ $line =~ ^\\[[^]]+\\]$ ]]; then
60
- if (( in_dev_contracts )) && [[ $line =~ ^\\[development\\.contracts\\..+\\]$ ]]; then
61
- skip_entry=1
62
- in_dev_contracts=0
63
- continue
64
- fi
65
- in_dev_contracts=0
66
- skip_entry=0
67
- printf '%s\\n' "$line" >> "$temp"
68
- continue
69
- fi
70
-
71
- if (( skip_entry )); then
72
- continue
73
- fi
74
-
75
- if (( in_dev_contracts )); then
76
- if [[ $line =~ ^[[:space:]]*# ]]; then
77
- printf '%s\\n' "$line" >> "$temp"
78
- fi
79
- continue
80
- fi
81
-
82
- printf '%s\\n' "$line" >> "$temp"
83
- done < "$file"
84
-
85
- mv "$temp" "$file"
86
- }
87
- `;
88
- const updateWorkspaceCargo = `update_cargo() {
89
- cp Cargo.toml Cargo.toml.bak
90
-
91
- cat <<EOF > deps.tmp
92
- ${(0, zip_shared_1.addDependenciesWith)(`{ git = "https://github.com/OpenZeppelin/stellar-contracts", tag = "${version_1.contractsVersionTag}" }`, zip_shared_1.allStellarDependencies)}${(0, zip_shared_1.addDependenciesWith)(`{ version = "${version_1.compatibleSorobanVersion}" }`, ['soroban'])}
93
- EOF
94
-
95
- awk '
96
- BEGIN {
97
- inserted = 0
98
- deps = ""
99
- while ((getline line < "deps.tmp") > 0) {
100
- deps = deps line "\\n"
101
- }
102
- close("deps.tmp")
103
- }
104
- /^\\[workspace.dependencies\\]/ {
105
- in_deps = 1
106
- print
107
- if (!inserted) {
108
- printf "%s", deps
109
- inserted = 1
110
- }
111
- next
112
- }
113
- /^\\[/ { in_deps = 0 }
114
- in_deps { next }
115
- { print }
116
- ' Cargo.toml.bak > Cargo.toml
117
-
118
- rm deps.tmp
119
- rm Cargo.toml.bak
120
- }`;
121
- return `\
3
+ exports.zipScaffoldProject = void 0;
4
+ const zip_rust_1 = require("./zip-rust");
5
+ const setupSh = `\
122
6
  #!/usr/bin/env bash
123
7
  #
124
8
  # setup.sh
125
- #
126
- # This script is meant to set up a Scaffold project and insert the Wizard's contracts in the project
9
+ #
10
+ # This script is meant to set up a Scaffold project with the Wizard's contracts
127
11
 
128
12
  check_is_installed() {
129
13
  if ! which "$1" &> /dev/null; then
@@ -134,18 +18,7 @@ check_is_installed() {
134
18
  }
135
19
 
136
20
  scaffold() {
137
- tmp_folder="tmp"
138
- stellar scaffold init "$tmp_folder"
139
-
140
- rm -rf "$tmp_folder/contracts"
141
-
142
- local current_directory
143
- current_directory="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
144
-
145
- shopt -s dotglob
146
-
147
- cp -a "$current_directory/$tmp_folder"/. "$current_directory"/
148
- rm -rf "$current_directory/$tmp_folder"
21
+ stellar-scaffold upgrade
149
22
  }
150
23
 
151
24
  init_git(){
@@ -154,10 +27,6 @@ init_git(){
154
27
  git commit -m "openzeppelin: add wizard output" --quiet
155
28
  }
156
29
 
157
- ${environmentsFileUpdate(c, scaffoldContractName)}
158
-
159
- ${updateWorkspaceCargo}
160
-
161
30
  build_contracts() {
162
31
  cargo build
163
32
  }
@@ -187,10 +56,6 @@ then
187
56
  echo "🏗️ Building Scaffold project"
188
57
 
189
58
  scaffold
190
-
191
- setup_environment
192
-
193
- update_cargo
194
59
 
195
60
  build_contracts
196
61
 
@@ -203,13 +68,10 @@ else
203
68
  echo "✅ Scaffold project already initialized."
204
69
  fi
205
70
  `;
206
- };
207
- const readme = (c) => {
208
- const hasTodosToResolve = (c) => getAddressArgs(c).length > 0;
209
- return `\
71
+ const wizardReadme = `\
210
72
  # Sample Scaffold Project
211
73
 
212
- This project demonstrates a basic Scaffold use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that initiate a Stellar Scaffold project with this contract. [Scaffold Stellar](https://github.com/AhaLabs/scaffold-stellar?tab=readme-ov-file#scaffold-stellar) is a convention-over-configuration toolkit for blockchain and distributed application development on the Stellar network. It provides a seamless development experience through CLI tools, smart contract management, and deployment utilities.
74
+ This project demonstrates a basic Scaffold use case. It comes with a contract generated by [OpenZeppelin Wizard](https://wizard.openzeppelin.com/), a test for that contract, and a script that initiates a Stellar Scaffold project with this contract. [Scaffold Stellar](https://github.com/AhaLabs/scaffold-stellar?tab=readme-ov-file#scaffold-stellar) is a convention-over-configuration toolkit for blockchain and distributed application development on the Stellar network. It provides a seamless development experience through CLI tools, smart contract management, and deployment utilities.
213
75
 
214
76
  ## Installing dependencies
215
77
 
@@ -224,7 +86,6 @@ This project demonstrates a basic Scaffold use case. It comes with a contract ge
224
86
  \`\`\`
225
87
  bash setup.sh
226
88
  \`\`\`
227
- ${hasTodosToResolve(c) ? '\n## Resolve any TODOs \n\nSearch for any TODO comments in the project and resolve them (search for TODO with your code editor).\n' : ''}
228
89
 
229
90
  ## Testing the contract
230
91
 
@@ -244,16 +105,11 @@ stellar scaffold watch --build-clients
244
105
  npm run dev
245
106
  \`\`\`
246
107
  `;
247
- };
248
- async function zipScaffold(c, opts) {
249
- const zip = new jszip_1.default();
250
- const scaffoldContractName = (0, zip_shared_1.contractOptionsToContractName)((opts === null || opts === void 0 ? void 0 : opts.kind) || 'contract');
251
- zip.file(`contracts/${scaffoldContractName}/src/contract.rs`, (0, print_1.removeCreateLevelAttributes)((0, print_1.printContract)(c)));
252
- zip.file(`contracts/${scaffoldContractName}/src/test.rs`, (0, zip_shared_1.printRustNameTest)(c));
253
- zip.file(`contracts/${scaffoldContractName}/src/lib.rs`, zip_shared_1.createRustLibFile);
254
- zip.file(`contracts/${scaffoldContractName}/Cargo.toml`, (0, zip_shared_1.printContractCargo)(scaffoldContractName));
255
- zip.file('setup.sh', setupSh(c, opts, scaffoldContractName));
256
- zip.file('README-WIZARD.md', readme(c));
108
+ const addScaffoldProjectFiles = (zip) => {
109
+ zip.file('README-WIZARD.md', wizardReadme);
110
+ zip.file('setup.sh', setupSh);
257
111
  return zip;
258
- }
112
+ };
113
+ const zipScaffoldProject = async (c, opts) => addScaffoldProjectFiles((0, zip_rust_1.createRustZipEnvironment)(c, opts));
114
+ exports.zipScaffoldProject = zipScaffoldProject;
259
115
  //# sourceMappingURL=zip-scaffold.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zip-scaffold.js","sourceRoot":"","sources":["../src/zip-scaffold.ts"],"names":[],"mappings":";;;;;AAmQA,kCAaC;AAhRD,kDAA0B;AAG1B,mCAAqE;AACrE,6CAAgF;AAChF,6CAOsB;AAEtB,SAAS,cAAc,CAAC,CAAW;IACjC,OAAO,CAAC,CAAC,eAAe;SACrB,MAAM,CAAC,cAAc,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,cAAc,CAAC,IAAI,0CAAE,WAAW,EAAE,MAAK,SAAS,CAAA,EAAA,CAAC;SAC1E,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,CAAW,EAAE,IAAoB,EAAE,oBAA4B,EAAE,EAAE;IAClF,MAAM,sBAAsB,GAAG,CAAC,aAAuB,EAAE,yBAAiC,EAAE,EAAE,CAAC;;;;;;;;;;;;+CAYlD,yBAAyB;;;;;;UAO9D,aAAa,CAAC,eAAe,CAAC,MAAM;QAClC,CAAC,CAAC,mBAAmB;YACnB;;WAEH,aAAa,CAAC,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,WAAC,OAAA,KAAK,cAAc,CAAC,IAAI,WAAW,cAAc,CAAC,IAAI,CAAC,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EAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AADhD,QAAA,kBAAkB,sBAC8B"}
@@ -3,24 +3,11 @@ declare function pascalToSnakeCase(string: string): string;
3
3
  export declare const contractOptionsToContractName: typeof pascalToSnakeCase;
4
4
  export declare function getAddressArgs(c: Pick<Contract, 'constructorArgs'>): string[];
5
5
  export declare const printRustNameTest: (c: Pick<Contract, "constructorArgs" | "name">) => string;
6
- export declare const stellarDependencies: {
7
- readonly base: readonly ["stellar-default-impl-macro"];
8
- readonly fungible: readonly ["stellar-fungible"];
9
- readonly nonFungible: readonly ["stellar-non-fungible"];
10
- readonly pausable: readonly ["stellar-pausable", "stellar-pausable-macros"];
11
- readonly upgradable: readonly ["stellar-upgradeable", "stellar-upgradeable-macros"];
12
- };
13
- export declare const allStellarDependencies: ("pausable" | "base" | "fungible" | "nonFungible" | "upgradable")[];
14
- export declare const allDependencies: {
15
- readonly soroban: readonly ["soroban-sdk"];
16
- readonly base: readonly ["stellar-default-impl-macro"];
17
- readonly fungible: readonly ["stellar-fungible"];
18
- readonly nonFungible: readonly ["stellar-non-fungible"];
19
- readonly pausable: readonly ["stellar-pausable", "stellar-pausable-macros"];
20
- readonly upgradable: readonly ["stellar-upgradeable", "stellar-upgradeable-macros"];
21
- };
22
- export declare const addDependenciesWith: (dependencyValue: string, dependenciesToAdd: (keyof typeof allDependencies)[]) => string;
6
+ export declare const libDependencies: readonly ["stellar-tokens", "stellar-access", "stellar-contract-utils", "stellar-macros"];
7
+ export declare const allDependencies: readonly ["stellar-tokens", "stellar-access", "stellar-contract-utils", "stellar-macros", "soroban-sdk"];
8
+ export declare const addDependenciesWith: (dependencyValue: string, dependenciesToAdd: string[]) => string;
23
9
  export declare const printContractCargo: (scaffoldContractName: string) => string;
24
10
  export declare const createRustLibFile = "#![no_std]\n#![allow(dead_code)]\n\nmod contract;\nmod test;\n";
11
+ export declare const workspaceCargo: string;
25
12
  export {};
26
13
  //# sourceMappingURL=zip-shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zip-shared.d.ts","sourceRoot":"","sources":["../src/zip-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,MAAM,UAKxC;AAED,eAAO,MAAM,6BAA6B,0BAAoB,CAAC;AAE/D,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,GAAG,MAAM,EAAE,CAI7E;AAED,eAAO,MAAM,iBAAiB,MAAO,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAAC,WAqB9E,CAAC;AAKF,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAC;AAEX,eAAO,MAAM,sBAAsB,qEAAiC,CAAC;AAErE,eAAO,MAAM,eAAe;;;;;;;CAGlB,CAAC;AAEX,eAAO,MAAM,mBAAmB,oBAAqB,MAAM,qBAAqB,CAAC,MAAM,OAAO,eAAe,CAAC,EAAE,WAGxG,CAAC;AAET,eAAO,MAAM,kBAAkB,yBAA0B,MAAM,WAcuB,CAAC;AAEvF,eAAO,MAAM,iBAAiB,mEAK7B,CAAC"}
1
+ {"version":3,"file":"zip-shared.d.ts","sourceRoot":"","sources":["../src/zip-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,iBAAS,iBAAiB,CAAC,MAAM,EAAE,MAAM,UAKxC;AAED,eAAO,MAAM,6BAA6B,0BAAoB,CAAC;AAE/D,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,GAAG,MAAM,EAAE,CAI7E;AAED,eAAO,MAAM,iBAAiB,MAAO,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAAC,WAqB9E,CAAC;AAEF,eAAO,MAAM,eAAe,2FAKlB,CAAC;AAEX,eAAO,MAAM,eAAe,0GAA+C,CAAC;AAE5E,eAAO,MAAM,mBAAmB,oBAAqB,MAAM,qBAAqB,MAAM,EAAE,WACG,CAAC;AAE5F,eAAO,MAAM,kBAAkB,yBAA0B,MAAM,WAc2B,CAAC;AAE3F,eAAO,MAAM,iBAAiB,mEAK7B,CAAC;AAEF,eAAO,MAAM,cAAc,QAY1B,CAAC"}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRustLibFile = exports.printContractCargo = exports.addDependenciesWith = exports.allDependencies = exports.allStellarDependencies = exports.stellarDependencies = exports.printRustNameTest = exports.contractOptionsToContractName = void 0;
3
+ exports.workspaceCargo = exports.createRustLibFile = exports.printContractCargo = exports.addDependenciesWith = exports.allDependencies = exports.libDependencies = exports.printRustNameTest = exports.contractOptionsToContractName = void 0;
4
4
  exports.getAddressArgs = getAddressArgs;
5
+ const version_1 = require("./utils/version");
5
6
  function pascalToSnakeCase(string) {
6
7
  return string
7
8
  .replace(/([A-Z])/g, '_$1')
@@ -37,22 +38,14 @@ fn initial_state() {
37
38
  // Add more tests bellow
38
39
  `;
39
40
  exports.printRustNameTest = printRustNameTest;
40
- const getKeysOf = (objectToGetKeysOf) => Object.keys(objectToGetKeysOf);
41
- exports.stellarDependencies = {
42
- base: ['stellar-default-impl-macro'],
43
- fungible: ['stellar-fungible'],
44
- nonFungible: ['stellar-non-fungible'],
45
- pausable: ['stellar-pausable', 'stellar-pausable-macros'],
46
- upgradable: ['stellar-upgradeable', 'stellar-upgradeable-macros'],
47
- };
48
- exports.allStellarDependencies = getKeysOf(exports.stellarDependencies);
49
- exports.allDependencies = {
50
- ...exports.stellarDependencies,
51
- soroban: ['soroban-sdk'],
52
- };
53
- const addDependenciesWith = (dependencyValue, dependenciesToAdd) => dependenciesToAdd.reduce((addedDependency, dependencyName) => {
54
- return `${addedDependency}${exports.allDependencies[dependencyName].map(cargoDependencies => `${cargoDependencies} = ${dependencyValue}\n`).join('')}`;
55
- }, '');
41
+ exports.libDependencies = [
42
+ 'stellar-tokens',
43
+ 'stellar-access',
44
+ 'stellar-contract-utils',
45
+ 'stellar-macros',
46
+ ];
47
+ exports.allDependencies = [...exports.libDependencies, 'soroban-sdk'];
48
+ const addDependenciesWith = (dependencyValue, dependenciesToAdd) => `${dependenciesToAdd.map(dependency => `${dependency} = ${dependencyValue}\n`).join('')}`;
56
49
  exports.addDependenciesWith = addDependenciesWith;
57
50
  const printContractCargo = (scaffoldContractName) => `[package]
58
51
  name = "${scaffoldContractName.replace(/_/, '-')}-contract"
@@ -66,9 +59,9 @@ crate-type = ["cdylib"]
66
59
  doctest = false
67
60
 
68
61
  [dependencies]
69
- ${(0, exports.addDependenciesWith)('{ workspace = true }', [...exports.allStellarDependencies, 'soroban'])}
62
+ ${(0, exports.addDependenciesWith)('{ workspace = true }', [...exports.allDependencies])}
70
63
  [dev-dependencies]
71
- ${(0, exports.addDependenciesWith)('{ workspace = true, features = ["testutils"] }', ['soroban'])}`;
64
+ ${(0, exports.addDependenciesWith)('{ workspace = true, features = ["testutils"] }', ['soroban-sdk'])}`;
72
65
  exports.printContractCargo = printContractCargo;
73
66
  exports.createRustLibFile = `#![no_std]
74
67
  #![allow(dead_code)]
@@ -76,4 +69,17 @@ exports.createRustLibFile = `#![no_std]
76
69
  mod contract;
77
70
  mod test;
78
71
  `;
72
+ exports.workspaceCargo = `[workspace]
73
+ resolver = "2"
74
+ members = ["contracts/*"]
75
+
76
+ [workspace.package]
77
+ authors = []
78
+ edition = "2021"
79
+ license = "Apache-2.0"
80
+ version = "0.0.1"
81
+
82
+ [workspace.dependencies]
83
+ ${(0, exports.addDependenciesWith)(`"${version_1.compatibleSorobanVersion}"`, ['soroban-sdk'])}${(0, exports.addDependenciesWith)(`"=${version_1.contractsVersion}"`, [...exports.libDependencies])}
84
+ `;
79
85
  //# sourceMappingURL=zip-shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zip-shared.js","sourceR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,uBAAe,EAAE,aAAa,CAAU,CAAC;AAErE,MAAM,mBAAmB,GAAG,CAAC,eAAuB,EAAE,iBAA2B,EAAE,EAAE,CAC1F,GAAG,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,MAAM,eAAe,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAD/E,QAAA,mBAAmB,uBAC4D;AAErF,MAAM,kBAAkB,GAAG,CAAC,oBAA4B,EAAE,EAAE,CAAC;UAC1D,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC;;;;;;;;;;;EAW9C,IAAA,2BAAmB,EAAC,sBAAsB,EAAE,CAAC,GAAG,uBAAe,CAAC,CAAC;;EAEjE,IAAA,2BAAmB,EAAC,gDAAgD,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;AAd9E,QAAA,kBAAkB,sBAc4D;AAE9E,QAAA,iBAAiB,GAAG;;;;;CAKhC,CAAC;AAEW,QAAA,cAAc,GAAG;;;;;;;;;;;EAW5B,IAAA,2BAAmB,EAAC,IAAI,kCAAwB,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,IAAA,2BAAmB,EAAC,KAAK,0BAAgB,GAAG,EAAE,CAAC,GAAG,uBAAe,CAAC,CAAC;CAC5I,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openzeppelin/wizard-stellar",
3
- "version": "0.3.0",
3
+ "version": "0.4.2",
4
4
  "description": "A boilerplate generator to get started with OpenZeppelin Stellar Soroban Contracts",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": "https://github.com/OpenZeppelin/contracts-wizard",
@@ -1,13 +1,13 @@
1
1
  import { getSelfArg } from './common-options';
2
- import type { ContractBuilder } from './contract';
2
+ import type { BaseFunction, ContractBuilder } from './contract';
3
3
  import type { Access } from './set-access-control';
4
4
  import { requireAccessControl } from './set-access-control';
5
5
  import { defineFunctions } from './utils/define-functions';
6
6
 
7
7
  export function addPausable(c: ContractBuilder, access: Access) {
8
- c.addUseClause('stellar_pausable', 'self', { alias: 'pausable' });
9
- c.addUseClause('stellar_pausable', 'Pausable');
10
- c.addUseClause('stellar_default_impl_macro', 'default_impl');
8
+ c.addUseClause('stellar_contract_utils::pausable', 'self', { alias: 'pausable' });
9
+ c.addUseClause('stellar_contract_utils::pausable', 'Pausable');
10
+ c.addUseClause('stellar_macros', 'default_impl');
11
11
 
12
12
  const pausableTrait = {
13
13
  traitName: 'Pausable',
@@ -16,12 +16,19 @@ export function addPausable(c: ContractBuilder, access: Access) {
16
16
  section: 'Utils',
17
17
  };
18
18
 
19
+ const pauseFn: BaseFunction = access === 'ownable' ? functions.pause_unused_caller : functions.pause;
20
+ const unpauseFn: BaseFunction = access === 'ownable' ? functions.unpause_unused_caller : functions.unpause;
21
+
19
22
  c.addTraitFunction(pausableTrait, functions.paused);
20
- c.addTraitFunction(pausableTrait, functions.pause);
21
- c.addTraitFunction(pausableTrait, functions.unpause);
23
+ c.addTraitFunction(pausableTrait, pauseFn);
24
+ c.addTraitFunction(pausableTrait, unpauseFn);
25
+ requireAccessControl(c, pausableTrait, pauseFn, access, {
26
+ useMacro: true,
27
+ role: 'pauser',
28
+ caller: 'caller',
29
+ });
22
30
 
23
- requireAccessControl(c, pausableTrait, functions.pause, access, { useMacro: true, role: 'pauser', caller: 'caller' });
24
- requireAccessControl(c, pausableTrait, functions.unpause, access, {
31
+ requireAccessControl(c, pausableTrait, unpauseFn, access, {
25
32
  useMacro: true,
26
33
  role: 'pauser',
27
34
  caller: 'caller',
@@ -38,8 +45,18 @@ const functions = defineFunctions({
38
45
  args: [getSelfArg(), { name: 'caller', type: 'Address' }],
39
46
  code: ['pausable::pause(e)'],
40
47
  },
48
+ pause_unused_caller: {
49
+ name: 'pause',
50
+ args: [getSelfArg(), { name: '_caller', type: 'Address' }],
51
+ code: ['pausable::pause(e)'],
52
+ },
41
53
  unpause: {
42
54
  args: [getSelfArg(), { name: 'caller', type: 'Address' }],
43
55
  code: ['pausable::unpause(e)'],
44
56
  },
57
+ unpause_unused_caller: {
58
+ name: 'unpause',
59
+ args: [getSelfArg(), { name: '_caller', type: 'Address' }],
60
+ code: ['pausable::unpause(e)'],
61
+ },
45
62
  });
@@ -1,19 +1,24 @@
1
1
  import { getSelfArg } from './common-options';
2
2
  import type { Access } from './set-access-control';
3
3
  import { requireAccessControl } from './set-access-control';
4
- import type { ContractBuilder } from './contract';
4
+ import type { BaseFunction, ContractBuilder } from './contract';
5
5
  import { defineFunctions } from './utils/define-functions';
6
6
 
7
7
  export function addUpgradeable(c: ContractBuilder, access: Access) {
8
8
  const functions = defineFunctions({
9
9
  _require_auth: {
10
10
  args: [getSelfArg(), { name: 'operator', type: '&Address' }],
11
+ code: ['operator.require_auth();'],
12
+ },
13
+ _require_auth_unused_operator: {
14
+ name: '_require_auth',
15
+ args: [getSelfArg(), { name: '_operator', type: '&Address' }],
11
16
  code: [],
12
17
  },
13
18
  });
14
19
 
15
- c.addUseClause('stellar_upgradeable', 'UpgradeableInternal');
16
- c.addUseClause('stellar_upgradeable_macros', 'Upgradeable');
20
+ c.addUseClause('stellar_contract_utils::upgradeable', 'UpgradeableInternal');
21
+ c.addUseClause('stellar_macros', 'Upgradeable');
17
22
 
18
23
  c.addDerives('Upgradeable');
19
24
 
@@ -24,9 +29,12 @@ export function addUpgradeable(c: ContractBuilder, access: Access) {
24
29
  section: 'Utils',
25
30
  };
26
31
 
27
- c.addTraitFunction(upgradeableTrait, functions._require_auth);
32
+ const upgradeFn: BaseFunction =
33
+ access === 'ownable' ? functions._require_auth_unused_operator : functions._require_auth;
34
+
35
+ c.addTraitFunction(upgradeableTrait, upgradeFn);
28
36
 
29
- requireAccessControl(c, upgradeableTrait, functions._require_auth, access, {
37
+ requireAccessControl(c, upgradeableTrait, upgradeFn, access, {
30
38
  useMacro: false,
31
39
  role: 'upgrader',
32
40
  caller: 'operator',
package/src/fungible.ts CHANGED
@@ -92,12 +92,11 @@ function addBase(c: ContractBuilder, name: string, symbol: string, pausable: boo
92
92
  c.addConstructorCode(`Base::set_metadata(e, 18, String::from_str(e, "${name}"), String::from_str(e, "${symbol}"));`);
93
93
 
94
94
  // Set token functions
95
- c.addUseClause('stellar_fungible', 'Base');
96
- c.addUseClause('stellar_fungible', 'FungibleToken');
97
- c.addUseClause('stellar_default_impl_macro', 'default_impl');
95
+ c.addUseClause('stellar_tokens::fungible', 'Base');
96
+ c.addUseClause('stellar_tokens::fungible', 'FungibleToken');
97
+ c.addUseClause('stellar_macros', 'default_impl');
98
98
  c.addUseClause('soroban_sdk', 'contract');
99
99
  c.addUseClause('soroban_sdk', 'contractimpl');
100
- c.addUseClause('soroban_sdk', 'Address');
101
100
  c.addUseClause('soroban_sdk', 'String');
102
101
  c.addUseClause('soroban_sdk', 'Env');
103
102
 
@@ -111,7 +110,8 @@ function addBase(c: ContractBuilder, name: string, symbol: string, pausable: boo
111
110
  c.addTraitImplBlock(fungibleTokenTrait);
112
111
 
113
112
  if (pausable) {
114
- c.addUseClause('stellar_pausable_macros', 'when_not_paused');
113
+ c.addUseClause('soroban_sdk', 'Address');
114
+ c.addUseClause('stellar_macros', 'when_not_paused');
115
115
 
116
116
  c.addTraitFunction(fungibleTokenTrait, functions.transfer);
117
117
  c.addFunctionTag(functions.transfer, 'when_not_paused', fungibleTokenTrait);
@@ -122,6 +122,7 @@ function addBase(c: ContractBuilder, name: string, symbol: string, pausable: boo
122
122
  }
123
123
 
124
124
  function addMintable(c: ContractBuilder, access: Access, pausable: boolean) {
125
+ c.addUseClause('soroban_sdk', 'Address');
125
126
  switch (access) {
126
127
  case false:
127
128
  break;
@@ -157,7 +158,7 @@ function addMintable(c: ContractBuilder, access: Access, pausable: boolean) {
157
158
  }
158
159
 
159
160
  function addBurnable(c: ContractBuilder, pausable: boolean) {
160
- c.addUseClause('stellar_fungible', 'burnable::FungibleBurnable');
161
+ c.addUseClause('stellar_tokens::fungible', 'burnable::FungibleBurnable');
161
162
  c.addUseClause('soroban_sdk', 'Address');
162
163
 
163
164
  const fungibleBurnableTrait = {
@@ -168,7 +169,7 @@ function addBurnable(c: ContractBuilder, pausable: boolean) {
168
169
  };
169
170
 
170
171
  if (pausable) {
171
- c.addUseClause('stellar_pausable_macros', 'when_not_paused');
172
+ c.addUseClause('stellar_macros', 'when_not_paused');
172
173
 
173
174
  c.addTraitFunction(fungibleBurnableTrait, functions.burn);
174
175
  c.addFunctionTag(functions.burn, 'when_not_paused', fungibleBurnableTrait);
@@ -127,12 +127,11 @@ function addBase(c: ContractBuilder, name: string, symbol: string, pausable: boo
127
127
  c.addConstructorCode(`Base::set_metadata(e, uri, name, symbol);`);
128
128
 
129
129
  // Set token functions
130
- c.addUseClause('stellar_non_fungible', 'Base');
131
- c.addUseClause('stellar_non_fungible', 'NonFungibleToken');
132
- c.addUseClause('stellar_default_impl_macro', 'default_impl');
130
+ c.addUseClause('stellar_tokens::non_fungible', 'Base');
131
+ c.addUseClause('stellar_tokens::non_fungible', 'NonFungibleToken');
132
+ c.addUseClause('stellar_macros', 'default_impl');
133
133
  c.addUseClause('soroban_sdk', 'contract');
134
134
  c.addUseClause('soroban_sdk', 'contractimpl');
135
- c.addUseClause('soroban_sdk', 'Address');
136
135
  c.addUseClause('soroban_sdk', 'String');
137
136
  c.addUseClause('soroban_sdk', 'Env');
138
137
 
@@ -146,7 +145,7 @@ function addBase(c: ContractBuilder, name: string, symbol: string, pausable: boo
146
145
  c.addTraitImplBlock(nonFungibleTokenTrait);
147
146
 
148
147
  if (pausable) {
149
- c.addUseClause('stellar_pausable_macros', 'when_not_paused');
148
+ c.addUseClause('stellar_macros', 'when_not_paused');
150
149
 
151
150
  c.addTraitFunction(nonFungibleTokenTrait, baseFunctions.transfer);
152
151
  c.addFunctionTag(baseFunctions.transfer, 'when_not_paused', nonFungibleTokenTrait);
@@ -157,8 +156,7 @@ function addBase(c: ContractBuilder, name: string, symbol: string, pausable: boo
157
156
  }
158
157
 
159
158
  function addBurnable(c: ContractBuilder, pausable: boolean) {
160
- c.addUseClause('stellar_non_fungible', 'burnable::NonFungibleBurnable');
161
- c.addUseClause('soroban_sdk', 'Address');
159
+ c.addUseClause('stellar_tokens::non_fungible', 'burnable::NonFungibleBurnable');
162
160
 
163
161
  const nonFungibleBurnableTrait = {
164
162
  traitName: 'NonFungibleBurnable',
@@ -168,7 +166,7 @@ function addBurnable(c: ContractBuilder, pausable: boolean) {
168
166
  };
169
167
 
170
168
  if (pausable) {
171
- c.addUseClause('stellar_pausable_macros', 'when_not_paused');
169
+ c.addUseClause('stellar_macros', 'when_not_paused');
172
170
 
173
171
  c.addTraitFunction(nonFungibleBurnableTrait, burnableFunctions.burn);
174
172
  c.addFunctionTag(burnableFunctions.burn, 'when_not_paused', nonFungibleBurnableTrait);
@@ -183,8 +181,8 @@ function addBurnable(c: ContractBuilder, pausable: boolean) {
183
181
  }
184
182
 
185
183
  function addEnumerable(c: ContractBuilder) {
186
- c.addUseClause('stellar_non_fungible', 'enumerable::{NonFungibleEnumerable, Enumerable}');
187
- c.addUseClause('stellar_default_impl_macro', 'default_impl');
184
+ c.addUseClause('stellar_tokens::non_fungible', 'enumerable::{NonFungibleEnumerable, Enumerable}');
185
+ c.addUseClause('stellar_macros', 'default_impl');
188
186
 
189
187
  const nonFungibleEnumerableTrait = {
190
188
  traitName: 'NonFungibleEnumerable',
@@ -198,7 +196,8 @@ function addEnumerable(c: ContractBuilder) {
198
196
  }
199
197
 
200
198
  function addConsecutive(c: ContractBuilder, pausable: boolean, access: Access) {
201
- c.addUseClause('stellar_non_fungible', 'consecutive::{NonFungibleConsecutive, Consecutive}');
199
+ c.addUseClause('stellar_tokens::non_fungible', 'consecutive::{NonFungibleConsecutive, Consecutive}');
200
+ c.addUseClause('soroban_sdk', 'Address');
202
201
 
203
202
  const nonFungibleConsecutiveTrait = {
204
203
  traitName: 'NonFungibleConsecutive',
@@ -225,6 +224,7 @@ function addConsecutive(c: ContractBuilder, pausable: boolean, access: Access) {
225
224
  }
226
225
 
227
226
  function addMintable(c: ContractBuilder, enumerable: boolean, pausable: boolean, sequential: boolean, access: Access) {
227
+ c.addUseClause('soroban_sdk', 'Address');
228
228
  const accessProps = { useMacro: true, role: 'minter', caller: 'caller' };
229
229
 
230
230
  let mintFn;
@@ -21,8 +21,8 @@ export function setAccessControl(c: ContractBuilder, access: Access): void {
21
21
  if (!c.ownable) {
22
22
  c.ownable = true;
23
23
  c.addUseClause('soroban_sdk', 'Address');
24
- c.addUseClause('stellar_ownable', 'self', { alias: 'ownable' });
25
- c.addUseClause('stellar_ownable', 'Ownable');
24
+ c.addUseClause('stellar_access::ownable', 'self', { alias: 'ownable' });
25
+ c.addUseClause('stellar_access::ownable', 'Ownable');
26
26
 
27
27
  const ownableTrait = {
28
28
  traitName: 'Ownable',
@@ -39,8 +39,8 @@ export function setAccessControl(c: ContractBuilder, access: Access): void {
39
39
  }
40
40
  case 'roles': {
41
41
  c.addUseClause('soroban_sdk', 'Address');
42
- c.addUseClause('stellar_access_control', 'self', { alias: 'access_control' });
43
- c.addUseClause('stellar_access_control', 'AccessControl');
42
+ c.addUseClause('stellar_access::access_control', 'self', { alias: 'access_control' });
43
+ c.addUseClause('stellar_access::access_control', 'AccessControl');
44
44
 
45
45
  const accessControltrait = {
46
46
  traitName: 'AccessControl',
@@ -78,7 +78,7 @@ export function requireAccessControl(
78
78
 
79
79
  switch (access) {
80
80
  case 'ownable': {
81
- c.addUseClause('stellar_ownable_macro', 'only_owner');
81
+ c.addUseClause('stellar_macros', 'only_owner');
82
82
 
83
83
  if (accessProps.useMacro) {
84
84
  c.addFunctionTag(fn, 'only_owner', trait);
@@ -97,7 +97,7 @@ export function requireAccessControl(
97
97
  c.addConstructorCode(`access_control::grant_role_no_auth(e, &admin, &${role}, &Symbol::new(e, "${role}"));`);
98
98
 
99
99
  if (useMacro) {
100
- c.addUseClause('stellar_access_control_macros', 'only_role');
100
+ c.addUseClause('stellar_macros', 'only_role');
101
101
  c.addFunctionTag(fn, `only_role(${caller}, "${role}")`, trait);
102
102
  } else {
103
103
  c.addFunctionCodeBefore(
@@ -108,7 +108,7 @@ export function requireAccessControl(
108
108
  }
109
109
  } else {
110
110
  if (useMacro) {
111
- c.addUseClause('stellar_access_control_macros', 'only_admin');
111
+ c.addUseClause('stellar_macros', 'only_admin');
112
112
  c.addFunctionTag(fn, 'only_admin', trait);
113
113
  } else {
114
114
  c.addFunctionCodeBefore(fn, ['access_control::enforce_admin_auth(e);'], trait);
package/src/stablecoin.ts CHANGED
@@ -65,10 +65,10 @@ function addLimitations(c: ContractBuilder, access: Access, mode: 'allowlist' |
65
65
  };
66
66
 
67
67
  if (type) {
68
- c.addUseClause('stellar_fungible', 'allowlist::{AllowList, FungibleAllowList}');
68
+ c.addUseClause('stellar_tokens::fungible', 'allowlist::{AllowList, FungibleAllowList}');
69
69
  c.overrideAssocType('FungibleToken', 'type ContractType = AllowList;');
70
70
  } else {
71
- c.addUseClause('stellar_fungible', 'blocklist::{BlockList, FungibleBlockList}');
71
+ c.addUseClause('stellar_tokens::fungible', 'blocklist::{BlockList, FungibleBlockList}');
72
72
  c.overrideAssocType('FungibleToken', 'type ContractType = BlockList;');
73
73
  }
74
74