Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ ifeq ($(findstring --network linea-sepolia,$(ARGS)),--network linea-sepolia)
NETWORK_ARGS := --rpc-url $(LINEA_SEPOLIA_RPC_URL) --account $(ACCOUNT) --broadcast --verify --verifier-url https://api.etherscan.io/v2/api --etherscan-api-key $(ETHERSCAN_API_KEY) --chain 59141 -vvvv
endif

ifeq ($(findstring --network celo-mainnet,$(ARGS)),--network celo-mainnet)
NETWORK_ARGS := --rpc-url $(CELO_MAINNET_RPC_URL) --account $(ACCOUNT) --broadcast --verify --verifier-url https://api.etherscan.io/v2/api --etherscan-api-key $(ETHERSCAN_API_KEY) --etherscan-api-version v2 --chain 42220 -vvvv
endif

ifeq ($(findstring --network celo-sepolia,$(ARGS)),--network celo-sepolia)
NETWORK_ARGS := --rpc-url $(CELO_SEPOLIA_RPC_URL) --account $(ACCOUNT) --broadcast --verify --verifier-url https://api.etherscan.io/v2/api --etherscan-api-key $(ETHERSCAN_API_KEY) --etherscan-api-version v2 --chain 11142220 -vvvv
endif

deploy-mainnet:
@forge script script/DeployJustaPermissionManager.s.sol:DeployJustaPermissionManager $(NETWORK_ARGS)

Expand Down Expand Up @@ -130,4 +138,10 @@ deploy-linea-mainnet:
@forge script script/DeployJustaPermissionManager.s.sol:DeployJustaPermissionManager $(NETWORK_ARGS)

deploy-linea-sepolia:
@forge script script/DeployJustaPermissionManager.s.sol:DeployJustaPermissionManager $(NETWORK_ARGS)

deploy-celo-mainnet:
@forge script script/DeployJustaPermissionManager.s.sol:DeployJustaPermissionManager $(NETWORK_ARGS)

deploy-celo-sepolia:
@forge script script/DeployJustaPermissionManager.s.sol:DeployJustaPermissionManager $(NETWORK_ARGS)
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@

**CAUTION: These contracts are not yet audited. Use with caution.**

## Temporary Deployment Addresses
## Deployment Addresses

- **JustaPermissionManager**: `0x914d7fec6aac8cd542e72bca78b30650d45643d7`
**JustaPermissionManager**: `0xf1b40E3D5701C04d86F7828f0EB367B9C90901D8`

**Deployed on:**

- Base Sepolia
| Network | Chain ID | Testnet | Chain ID |
|---------|----------|---------|----------|
| Ethereum Mainnet | 1 | Sepolia | 11155111 |
| Base | 8453 | Base Sepolia | 84532 |
| Optimism | 10 | OP Sepolia | 11155420 |
| Arbitrum One | 42161 | Arbitrum Sepolia | 421614 |
| BSC | 56 | BSC Testnet | 97 |
| Linea | 59144 | Linea Sepolia | 59141 |
| Avalanche | 43114 | Avalanche Fuji | 43113 |
| Celo | 42220 | Celo Sepolia | 11142220 |

## Overview

Expand Down
Binary file added audits/.DS_Store
Binary file not shown.
Binary file added audits/Nethermind-March-2026.pdf
Binary file not shown.
53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/1/run-1772527935.json

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/1/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/10/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/42161/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/42220/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/43113/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/43114/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/56/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/59141/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/59144/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/8453/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions broadcast/DeployJustaPermissionManager.s.sol/84532/run-latest.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions broadcast/DeployJustaPermissionManager.s.sol/97/run-latest.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions script/DeployJustaPermissionManager.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { JustaPermissionManager } from "../src/JustaPermissionManager.sol";
*/
contract DeployJustaPermissionManager is Script {

address constant EXPECTED_MANAGER = address(0);
address constant EXPECTED_MANAGER = address(0xf1b40E3D5701C04d86F7828f0EB367B9C90901D8);

bytes32 constant MANAGER_SALT = 0x0000000000000000000000000000000000000000000000000000000000000000;
bytes32 constant MANAGER_SALT = 0x0000000000000000000000000000000000000000000000000000000000000001;

function run() public {
console2.log("Deploying on chain ID", block.chainid);
Expand Down
6 changes: 5 additions & 1 deletion script/HelperConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ abstract contract CodeConstants {
uint256 public constant LINEA_CHAIN_ID = 59_144;
uint256 public constant LINEA_SEPOLIA_CHAIN_ID = 59_141;

uint256 public constant CELO_CHAIN_ID = 42_220;
uint256 public constant CELO_SEPOLIA_CHAIN_ID = 11_142_220;

////////////////////////////////////////////////////////////////////////
// ENTRY POINT
////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -111,7 +114,8 @@ contract HelperConfig is CodeConstants, Script {
|| chainId == BASE_SEPOLIA_CHAIN_ID || chainId == OPTIMISM_CHAIN_ID || chainId == OPTIMISM_SEPOLIA_CHAIN_ID
|| chainId == ARBITRUM_ONE_CHAIN_ID || chainId == ARBITRUM_SEPOLIA_CHAIN_ID || chainId == AVALANCHE_CHAIN_ID
|| chainId == AVALANCHE_FUJI_CHAIN_ID || chainId == BSC_CHAIN_ID || chainId == BSC_TESTNET_CHAIN_ID
|| chainId == LINEA_CHAIN_ID || chainId == LINEA_SEPOLIA_CHAIN_ID;
|| chainId == LINEA_CHAIN_ID || chainId == LINEA_SEPOLIA_CHAIN_ID || chainId == CELO_CHAIN_ID
|| chainId == CELO_SEPOLIA_CHAIN_ID;
}

function getConfigByChainId(uint256 chainId) public returns (NetworkConfig memory) {
Expand Down
30 changes: 12 additions & 18 deletions test/unit/TestReadFunctions.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,8 @@ contract TestReadFunctions is Test, PreparePermission {
calls[0] = createCall(address(mockToken), selector);

JustaPermissionManager.SpendLimit[] memory spends = new JustaPermissionManager.SpendLimit[](1);
spends[0] = createSpendLimit(
address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier
);
spends[0] =
createSpendLimit(address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier);

JustaPermissionManager.Permission memory permission1 = createPermission(
TEST_ACCOUNT_ADDRESS,
Expand Down Expand Up @@ -463,9 +462,8 @@ contract TestReadFunctions is Test, PreparePermission {
multiplier
);

JustaPermissionManager.SpendLimit memory spendLimit = createSpendLimit(
address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier
);
JustaPermissionManager.SpendLimit memory spendLimit =
createSpendLimit(address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier);

JustaPermissionManager.PeriodSpend memory periodSpend = manager.getLastUpdatedPeriod(permission, spendLimit);

Expand Down Expand Up @@ -506,9 +504,8 @@ contract TestReadFunctions is Test, PreparePermission {
vm.prank(TEST_ACCOUNT_ADDRESS);
manager.approve(permission);

JustaPermissionManager.SpendLimit memory spendLimit = createSpendLimit(
address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier
);
JustaPermissionManager.SpendLimit memory spendLimit =
createSpendLimit(address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier);

JustaPermissionManager.PeriodSpend memory periodSpend = manager.getLastUpdatedPeriod(permission, spendLimit);

Expand Down Expand Up @@ -552,9 +549,8 @@ contract TestReadFunctions is Test, PreparePermission {
multiplier
);

JustaPermissionManager.SpendLimit memory spendLimit = createSpendLimit(
address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier
);
JustaPermissionManager.SpendLimit memory spendLimit =
createSpendLimit(address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier);

JustaPermissionManager.PeriodSpend memory periodSpend = manager.getCurrentPeriod(permission, spendLimit);

Expand Down Expand Up @@ -592,9 +588,8 @@ contract TestReadFunctions is Test, PreparePermission {
multiplier
);

JustaPermissionManager.SpendLimit memory spendLimit = createSpendLimit(
address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier
);
JustaPermissionManager.SpendLimit memory spendLimit =
createSpendLimit(address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier);

vm.expectRevert(
abi.encodeWithSelector(
Expand Down Expand Up @@ -639,9 +634,8 @@ contract TestReadFunctions is Test, PreparePermission {
multiplier
);

JustaPermissionManager.SpendLimit memory spendLimit = createSpendLimit(
address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier
);
JustaPermissionManager.SpendLimit memory spendLimit =
createSpendLimit(address(mockToken), allowance, JustaPermissionManager.PeriodUnit(periodUnit), multiplier);

// Calculate expected timestamp after warp BEFORE warping
uint48 expectedTimestampAfterWarp = uint48(block.timestamp + 2 days);
Expand Down
Loading