@towns-protocol/contracts 0.0.431 → 0.0.433
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/README.md +3 -4
- package/docs/permitAndStake_integration_guide.md +1 -1
- package/package.json +3 -3
- package/src/apps/facets/registry/AppRegistryBase.sol +3 -2
- package/src/spaces/facets/account/AppAccount.sol +5 -4
- package/src/spaces/facets/account/IAppAccount.sol +0 -16
- package/src/spaces/facets/account/IAppExecution.sol +26 -0
package/README.md
CHANGED
|
@@ -58,11 +58,10 @@ The system also supports cross-chain delegation between Ethereum L1 and Base L2,
|
|
|
58
58
|
|
|
59
59
|
## Requirements
|
|
60
60
|
|
|
61
|
-
Install [
|
|
61
|
+
Install [Bun](https://bun.sh/):
|
|
62
62
|
|
|
63
63
|
```shell
|
|
64
|
-
|
|
65
|
-
corepack enable
|
|
64
|
+
curl -fsSL https://bun.sh/install | bash
|
|
66
65
|
```
|
|
67
66
|
|
|
68
67
|
Install [Foundry](https://github.com/foundry-rs/foundry):
|
|
@@ -77,7 +76,7 @@ foundryup
|
|
|
77
76
|
Clone the repo, then:
|
|
78
77
|
|
|
79
78
|
```shell
|
|
80
|
-
|
|
79
|
+
bun install
|
|
81
80
|
```
|
|
82
81
|
|
|
83
82
|
**To compile the smart contracts:**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@towns-protocol/contracts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.433",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "forge clean",
|
|
6
6
|
"compile": "forge build",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@layerzerolabs/oapp-evm": "^0.3.2",
|
|
34
34
|
"@openzeppelin/merkle-tree": "^1.0.8",
|
|
35
35
|
"@prb/test": "^0.6.4",
|
|
36
|
-
"@towns-protocol/prettier-config": "^0.0.
|
|
36
|
+
"@towns-protocol/prettier-config": "^0.0.433",
|
|
37
37
|
"@wagmi/cli": "^2.2.0",
|
|
38
38
|
"forge-std": "github:foundry-rs/forge-std#v1.10.0",
|
|
39
39
|
"prettier": "^3.5.3",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "0fe7289140a4eb11ccc26cc9deb3c1818d0d5ea3"
|
|
54
54
|
}
|
|
@@ -33,7 +33,9 @@ abstract contract AppRegistryBase is IAppRegistryBase, SchemaBase, AttestationBa
|
|
|
33
33
|
using CustomRevert for bytes4;
|
|
34
34
|
|
|
35
35
|
modifier onlyAllowed(IAppAccount account) {
|
|
36
|
-
if (IERC173(address(account)).owner() != msg.sender)
|
|
36
|
+
if (address(account) != msg.sender && IERC173(address(account)).owner() != msg.sender) {
|
|
37
|
+
NotAllowed.selector.revertWith();
|
|
38
|
+
}
|
|
37
39
|
_;
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -247,7 +249,6 @@ abstract contract AppRegistryBase is IAppRegistryBase, SchemaBase, AttestationBa
|
|
|
247
249
|
|
|
248
250
|
ITownsApp appContract = ITownsApp(app);
|
|
249
251
|
uint256 installPrice = appContract.installPrice();
|
|
250
|
-
|
|
251
252
|
_chargeForInstall(msg.sender, app, installPrice);
|
|
252
253
|
|
|
253
254
|
IAppAccount(account).onInstallApp(appId, data);
|
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.23;
|
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {IAppAccount} from "./IAppAccount.sol";
|
|
6
|
+
import {IAppExecution} from "./IAppExecution.sol";
|
|
6
7
|
|
|
7
8
|
// libraries
|
|
8
9
|
import {AppAccountBase} from "./AppAccountBase.sol";
|
|
@@ -17,12 +18,12 @@ import {ReentrancyGuard} from "solady/utils/ReentrancyGuard.sol";
|
|
|
17
18
|
* @notice A lightweight modular erc6900 semi-compatible account
|
|
18
19
|
* @dev This account is used to execute transactions on behalf of a Space
|
|
19
20
|
*/
|
|
20
|
-
contract AppAccount is IAppAccount, AppAccountBase, ReentrancyGuard, Facet {
|
|
21
|
+
contract AppAccount is IAppAccount, IAppExecution, AppAccountBase, ReentrancyGuard, Facet {
|
|
21
22
|
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
|
|
22
23
|
/* Execution */
|
|
23
24
|
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
|
|
24
25
|
|
|
25
|
-
/// @inheritdoc
|
|
26
|
+
/// @inheritdoc IAppExecution
|
|
26
27
|
function execute(
|
|
27
28
|
address target,
|
|
28
29
|
uint256 value,
|
|
@@ -98,8 +99,8 @@ contract AppAccount is IAppAccount, AppAccountBase, ReentrancyGuard, Facet {
|
|
|
98
99
|
return _isAppEntitled(app, publicKey, permission);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
/// @inheritdoc
|
|
102
|
-
function isAppExecuting(address app) external view returns (bool) {
|
|
102
|
+
/// @inheritdoc IAppExecution
|
|
103
|
+
function isAppExecuting(address app) external view override returns (bool) {
|
|
103
104
|
return _isAppExecuting(app);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
@@ -78,20 +78,4 @@ interface IAppAccount is IAppAccountBase {
|
|
|
78
78
|
address publicKey,
|
|
79
79
|
bytes32 permission
|
|
80
80
|
) external view returns (bool);
|
|
81
|
-
|
|
82
|
-
/// @notice Checks if an app is executing
|
|
83
|
-
/// @param app The address of the app to check
|
|
84
|
-
/// @return True if the app is executing, false otherwise
|
|
85
|
-
function isAppExecuting(address app) external view returns (bool);
|
|
86
|
-
|
|
87
|
-
/// @notice Executes a function on the app
|
|
88
|
-
/// @param target The address of the app to execute the function on
|
|
89
|
-
/// @param value The value to send with the function
|
|
90
|
-
/// @param data The data to send with the function
|
|
91
|
-
/// @return The result of the function
|
|
92
|
-
function execute(
|
|
93
|
-
address target,
|
|
94
|
-
uint256 value,
|
|
95
|
-
bytes calldata data
|
|
96
|
-
) external payable returns (bytes memory);
|
|
97
81
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.29;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
|
|
6
|
+
// libraries
|
|
7
|
+
|
|
8
|
+
// contracts
|
|
9
|
+
|
|
10
|
+
interface IAppExecution {
|
|
11
|
+
/// @notice Checks if an app is executing
|
|
12
|
+
/// @param app The address of the app to check
|
|
13
|
+
/// @return True if the app is executing, false otherwise
|
|
14
|
+
function isAppExecuting(address app) external view returns (bool);
|
|
15
|
+
|
|
16
|
+
/// @notice Executes a function on the app
|
|
17
|
+
/// @param target The address of the app to execute the function on
|
|
18
|
+
/// @param value The value to send with the function
|
|
19
|
+
/// @param data The data to send with the function
|
|
20
|
+
/// @return The result of the function
|
|
21
|
+
function execute(
|
|
22
|
+
address target,
|
|
23
|
+
uint256 value,
|
|
24
|
+
bytes calldata data
|
|
25
|
+
) external payable returns (bytes memory);
|
|
26
|
+
}
|