Skip to content

Commit eedee83

Browse files
committed
v0.4
1 parent 78b73af commit eedee83

File tree

78 files changed

+6487
-3885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+6487
-3885
lines changed
100 KB
Binary file not shown.

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ jobs:
2626
- name: Setup...
2727
run: scripts/setup.sh
2828

29+
- name: Build...
30+
run: scripts/build-cairo.sh &&
31+
./scripts/build-solidity.sh
32+
2933
- name: Run Tests...
3034
run: scripts/tests.sh

scripts/build-cairo.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/bash
22
pushd $(dirname $0)/..
3-
3+
set -e
44
mkdir -p cairo_contracts
55

6-
scripts/starknet-compile.py src --contract-path src::permissioned_erc20::PermissionedERC20 cairo_contracts/PermissionedERC20.sierra
6+
scripts/starknet-compile.py src --contract-path src::roles_init_eic::RolesExternalInitializer cairo_contracts/RolesExternalInitializer.sierra
7+
scripts/starknet-compile.py src --contract-path src::legacy_bridge_eic::LegacyBridgeUpgradeEIC cairo_contracts/LegacyBridgeUpgradeEIC.sierra
78
scripts/starknet-compile.py src --contract-path src::token_bridge::TokenBridge cairo_contracts/TokenBridge.sierra
8-
scripts/starknet-compile.py src --contract-path openzeppelin::token::erc20::erc20::ERC20 cairo_contracts/ERC20.sierra
99
scripts/starknet-compile.py src --contract-path openzeppelin::token::erc20::presets::erc20votes::ERC20VotesPreset cairo_contracts/ERC20VotesPreset.sierra
1010
scripts/starknet-compile.py src --contract-path openzeppelin::token::erc20_v070::erc20::ERC20 cairo_contracts/ERC20.sierra
11-
11+
set +e
1212
popd

scripts/build-solidity.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ pushd $(dirname $0)/..
33

44
mkdir -p artifacts
55

6+
set -e
67
.downloads/solc-0.8.20 $(cat src/solidity/files_to_compile.txt) --allow-paths .=., --optimize --optimize-runs 200 --overwrite --combined-json abi,bin -o artifacts
78
scripts/extract_artifacts.py
9+
set +e
810

911
popd

scripts/cairo-format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
99
EXECUTABLE = os.path.join(ROOT_DIR, ".downloads", "cairo", "bin", "cairo-format")
10-
EXPECTED_EXECUTABLE_VERSION = "cairo-format 2.2.0"
10+
EXPECTED_EXECUTABLE_VERSION = "cairo-format 2.3.0"
1111

1212

1313
def main():

scripts/cairo-test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
99
EXECUTABLE = os.path.join(ROOT_DIR, ".downloads", "cairo", "bin", "cairo-test")
10-
EXPECTED_EXECUTABLE_VERSION = "cairo-test 2.2.0"
10+
EXPECTED_EXECUTABLE_VERSION = "cairo-test 2.3.0"
1111

1212

1313
def main():

scripts/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ printf "${COLOR_OFF}"
3030
mkdir -p .downloads
3131
cd .downloads
3232

33-
wget -c https://github.com/starkware-libs/cairo/releases/download/v2.2.0/release-x86_64-unknown-linux-musl.tar.gz -O - | tar -xz
33+
wget -c https://github.com/starkware-libs/cairo/releases/download/v2.3.0/release-x86_64-unknown-linux-musl.tar.gz -O - | tar -xz
3434
curl https://binaries.soliditylang.org/linux-amd64/solc-linux-amd64-v0.8.20+commit.a1b79de6 -o solc-0.8.20 && chmod +x solc-0.8.20
3535

3636
cd ..

scripts/starknet-compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
99
EXECUTABLE = os.path.join(ROOT_DIR, ".downloads", "cairo", "bin", "starknet-compile")
10-
EXPECTED_EXECUTABLE_VERSION = "starknet-compile 2.2.0"
10+
EXPECTED_EXECUTABLE_VERSION = "starknet-compile 2.3.0"
1111

1212

1313
def main():

scripts/tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ else
5959
exit 1
6060
fi
6161

62-
6362
printf "${YELLOW}Pytest...\n"
6463
pytest src/solidity -sv
6564
if [ $? -eq 0 ]; then

src/cairo/access_control_interface.cairo

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,35 @@ trait IAccessControl<TContractState> {
88
fn has_role(self: @TContractState, role: RoleId, account: ContractAddress) -> bool;
99
fn get_role_admin(self: @TContractState, role: RoleId) -> RoleId;
1010
}
11+
12+
// An event that is emitted when `account` is granted `role`.
13+
// `sender` is the account that originated the contract call, an admin role
14+
// bearer (except if `_grant_role` is called during initialization from the constructor).
15+
#[derive(Copy, Drop, PartialEq, starknet::Event)]
16+
struct RoleGranted {
17+
role: RoleId,
18+
account: ContractAddress,
19+
sender: ContractAddress,
20+
}
21+
22+
// An event that is emitted when `account` is revoked `role`.
23+
// `sender` is the account that originated the contract call:
24+
// - If using `revoke_role`, it is the admin role bearer.
25+
// - If using `renounce_role`, it is the role bearer (i.e. `account`).
26+
#[derive(Copy, Drop, PartialEq, starknet::Event)]
27+
struct RoleRevoked {
28+
role: RoleId,
29+
account: ContractAddress,
30+
sender: ContractAddress,
31+
}
32+
33+
// An event that is emitted when `new_admin_role` is set as `role`'s admin role, replacing
34+
// `previous_admin_role`.
35+
// `DEFAULT_ADMIN_ROLE`(0) is the starting admin for all roles, despite {RoleAdminChanged} not
36+
// being emitted signaling this.
37+
#[derive(Copy, Drop, PartialEq, starknet::Event)]
38+
struct RoleAdminChanged {
39+
role: RoleId,
40+
previous_admin_role: RoleId,
41+
new_admin_role: RoleId,
42+
}

0 commit comments

Comments
 (0)