@alephium/web3 0.2.0-rc.2 → 0.2.0-rc.5

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,15 @@
1
- import "../sub/sub.ral"
2
-
3
1
  Contract Add(subContractId: ByteVec, mut result : U256) {
4
2
  event Add(x: U256, y: U256)
5
3
 
4
+ @using(permissionCheck = false)
6
5
  pub fn add(array: [U256; 2]) -> ([U256; 2]) {
6
+ return addPrivate(array)
7
+ }
8
+
9
+ fn addPrivate(array: [U256; 2]) -> ([U256; 2]) {
7
10
  emit Add(array[0], array[1])
8
11
  let sub = Sub(subContractId)
9
12
  result = result + array[0] + array[1]
10
13
  return [result, sub.sub(array)]
11
14
  }
12
-
13
- fn addPrivate(array: [U256; 2]) -> ([U256; 2]) {
14
- return add(array)
15
- }
16
15
  }
@@ -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
+ checkPermission!(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(permissionCheck = 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]
@@ -0,0 +1,18 @@
1
+ Contract MetaData() {
2
+ @using(preapprovedAssets = true, assetsInContract = false)
3
+ pub fn foo() -> () {
4
+ transferAlph!(callerAddress!(), callerAddress!(), 1 alph)
5
+ return
6
+ }
7
+
8
+ @using(preapprovedAssets = false, assetsInContract = true)
9
+ fn bar() -> () {
10
+ transferAlphToSelf!(selfAddress!(), 1 alph)
11
+ return
12
+ }
13
+
14
+ @using(readonly = true)
15
+ fn baz() -> () {
16
+ return
17
+ }
18
+ }
@@ -0,0 +1,8 @@
1
+ Contract Warnings(@unused a: U256, b: U256) {
2
+ const C = 0
3
+
4
+ @using(readonly = true)
5
+ pub fn foo(@unused x: U256, y: U256) -> () {
6
+ return
7
+ }
8
+ }