@leofcoin/contracts 0.1.24 → 0.1.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/contracts",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,15 +18,16 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/leofcoin/monorepo"
21
+ "url": "git+https://github.com/leofcoin/monorepo.git",
22
+ "directory": "packages/contracts"
22
23
  },
23
24
  "keywords": [],
24
25
  "author": "",
25
26
  "license": "MIT",
26
27
  "bugs": {
27
- "url": "https://github.com/leofcoin/contracts/issues"
28
+ "url": "https://github.com/leofcoin/monorepo/issues"
28
29
  },
29
- "homepage": "https://github.com/leofcoin/contracts#readme",
30
+ "homepage": "https://github.com/leofcoin/monorepo/tree/main/packages/contracts#readme",
30
31
  "dependencies": {
31
32
  "@leofcoin/standards": "^0.3.7"
32
33
  },
package/src/validators.ts CHANGED
@@ -126,7 +126,7 @@ export default class Validators extends Roles {
126
126
  if (this.minimumBalance > balance)
127
127
  throw new Error(`balance to low! got: ${balance} need: ${this.#minimumBalance}`)
128
128
 
129
- await msg.call(this.currency, 'transfer', [validator, msg.contract, this.#minimumBalance])
129
+ await msg.call(this.currency, 'transferFrom', [validator, msg.contract, this.#minimumBalance])
130
130
 
131
131
  this.#balances[validator] = this.#minimumBalance
132
132
  this.#validators.push(validator)
@@ -135,7 +135,7 @@ export default class Validators extends Roles {
135
135
  async removeValidator(validator) {
136
136
  this.#isAllowed(validator)
137
137
  if (!this.has(validator)) throw new Error('validator not found')
138
- await msg.call(this.currency, 'transfer', [msg.contract, validator, this.#minimumBalance])
138
+ await msg.call(this.currency, 'transfer', [validator, this.#minimumBalance])
139
139
  delete this.#balances[validator]
140
140
  this.#validators.splice(this.#validators.indexOf(validator), 1)
141
141
  }
package/test/factory.js CHANGED
@@ -40,10 +40,11 @@ describe('Factory', () => {
40
40
  return BigInt(100) // Balance too low
41
41
  } else if (method === 'creator') {
42
42
  return true
43
- } else if (method === 'transfer') {
44
- throw new Error('amount exceeds balance')
45
43
  }
46
44
  }
45
+ global.msg.call = async (currency, method) => {
46
+ if (method === 'transferFrom') throw new Error('amount exceeds balance')
47
+ }
47
48
  await assert.rejects(async () => await factory.registerContract('0xContractAddress'), {
48
49
  message: 'amount exceeds balance'
49
50
  })
@@ -89,7 +89,7 @@ describe('Leofcoin', () => {
89
89
 
90
90
  it('allows allocated holders to transfer', () => {
91
91
  msg.sender = receiverAddress
92
- token.transfer(receiverAddress, otherReceiverAddress, 10_000n)
92
+ token.transfer(otherReceiverAddress, 10_000n)
93
93
  assert.equal(token.balanceOf(receiverAddress), 390_000n)
94
94
  assert.equal(token.balanceOf(otherReceiverAddress), 10_000n)
95
95
  })