@leofcoin/standards 0.2.12 → 0.2.13

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.
package/exports/token.js CHANGED
@@ -95,7 +95,7 @@ class Token extends Roles {
95
95
  }
96
96
  mint(to, amount) {
97
97
  if (!this.hasRole(msg.sender, 'MINT'))
98
- throw new Error('not allowed');
98
+ throw new Error('mint role required');
99
99
  const supply = this.#totalSupply + amount;
100
100
  if (this.#maxSupply === 0n) {
101
101
  this.#totalSupply = supply;
@@ -112,8 +112,8 @@ class Token extends Roles {
112
112
  }
113
113
  }
114
114
  burn(from, amount) {
115
- if (!this.hasRole(msg.sender, 'BURN') || msg.sender !== from)
116
- throw new Error('not allowed');
115
+ if (!this.hasRole(msg.sender, 'BURN') && msg.sender !== from)
116
+ throw new Error('not the owner or burn role required');
117
117
  const total = this.#totalSupply - amount;
118
118
  if (total >= 0) {
119
119
  this.#totalSupply = total;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/standards",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Contract standards",
5
5
  "type": "module",
6
6
  "exports": {
package/src/token.ts CHANGED
@@ -118,7 +118,7 @@ export default class Token extends Roles {
118
118
  }
119
119
 
120
120
  mint(to: address, amount: bigint) {
121
- if (!this.hasRole(msg.sender, 'MINT')) throw new Error('not allowed')
121
+ if (!this.hasRole(msg.sender, 'MINT')) throw new Error('mint role required')
122
122
 
123
123
  const supply = this.#totalSupply + amount
124
124
  if (this.#maxSupply === 0n) {
@@ -135,7 +135,7 @@ export default class Token extends Roles {
135
135
  }
136
136
 
137
137
  burn(from: address, amount: bigint) {
138
- if (!this.hasRole(msg.sender, 'BURN') || msg.sender !== from) throw new Error('not allowed')
138
+ if (!this.hasRole(msg.sender, 'BURN') && msg.sender !== from) throw new Error('not the owner or burn role required')
139
139
  const total = this.#totalSupply - amount
140
140
  if (total >= 0) {
141
141
  this.#totalSupply = total