@alephium/web3 0.2.0-rc.4 → 0.2.0-rc.7

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,16 +1,13 @@
1
- import "../sub/sub.ral"
2
-
3
- Contract Add(subContractId: ByteVec, mut result : U256) {
1
+ Contract Add(sub: Sub, mut result : U256) {
4
2
  event Add(x: U256, y: U256)
5
3
 
6
4
  pub fn add(array: [U256; 2]) -> ([U256; 2]) {
7
- emit Add(array[0], array[1])
8
- let sub = Sub(subContractId)
9
- result = result + array[0] + array[1]
10
- return [result, sub.sub(array)]
5
+ return addPrivate(array)
11
6
  }
12
7
 
13
8
  fn addPrivate(array: [U256; 2]) -> ([U256; 2]) {
14
- return add(array)
9
+ emit Add(array[0], array[1])
10
+ result = result + array[0] + array[1]
11
+ return [result, sub.sub(array)]
15
12
  }
16
13
  }
@@ -1,7 +1,7 @@
1
- import "greeter_interface.ral"
2
-
3
1
  Contract Greeter(btcPrice: U256) implements GreeterInterface {
2
+ @using(readonly = true)
4
3
  pub fn greet() -> U256 {
4
+ checkCaller!(true, 0)
5
5
  return btcPrice
6
6
  }
7
7
  }
@@ -1,3 +1,4 @@
1
1
  Interface GreeterInterface {
2
+ @using(readonly = true)
2
3
  pub fn greet() -> U256
3
4
  }
@@ -1,5 +1,3 @@
1
- import "./greeter/greeter.ral"
2
-
3
1
  TxScript Main(greeterContractId: ByteVec) {
4
2
  let greeter0 = Greeter(greeterContractId)
5
3
  assert!(greeter0.greet() == 1, 0)
@@ -1,5 +1,3 @@
1
- import "./add/add.ral"
2
-
3
1
  TxScript Main(addContractId: ByteVec) {
4
2
  let add = Add(addContractId)
5
3
  add.add([2, 1])
@@ -1,6 +1,7 @@
1
1
  Contract Sub(mut result : U256) {
2
2
  event Sub(x: U256, y: U256)
3
3
 
4
+ @using(externalCallCheck = false)
4
5
  pub fn sub(array: [U256; 2]) -> U256 {
5
6
  emit Sub(array[0], array[1])
6
7
  result = result + array[0] - array[1]
@@ -11,6 +11,7 @@ Contract MetaData() {
11
11
  return
12
12
  }
13
13
 
14
+ @using(readonly = true)
14
15
  fn baz() -> () {
15
16
  return
16
17
  }
@@ -1,6 +1,7 @@
1
1
  Contract Warnings(@unused a: U256, b: U256) {
2
2
  const C = 0
3
3
 
4
+ @using(readonly = true)
4
5
  pub fn foo(@unused x: U256, y: U256) -> () {
5
6
  return
6
7
  }