Skip to content

Commit eb393ed

Browse files
authored
feat(target_chains/starknet): add version method (#1630)
1 parent f899a34 commit eb393ed

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Starknet release checks
2+
3+
on:
4+
push:
5+
tags:
6+
- pyth-starknet-contract-v*
7+
jobs:
8+
check:
9+
name: Starknet release checks
10+
runs-on: ubuntu-latest
11+
defaults:
12+
run:
13+
working-directory: target_chains/starknet/contracts/
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Verify version
17+
run: |
18+
version1=$(grep version Scarb.toml | cut -d '"' -f 2)
19+
version2=${GITHUB_REF_NAME#"pyth-starknet-contract-v"}
20+
if [ "${version1}" != "${version2}" ]; then
21+
>&2 echo Version mismatch in Scarb.toml and tag name
22+
exit 1
23+
fi

.github/workflows/ci-starknet-contract.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ jobs:
3535
run: snforge test
3636
- name: Test local deployment script
3737
run: bash -c 'PATH="$PATH:$HOME/.config/.dojo/bin" katana & . ~/.config/.starkli/env && deploy/local_deploy'
38+
- name: Verify version
39+
run: |
40+
version1=$(grep version Scarb.toml | cut -d '"' -f 2)
41+
version2=$(grep -A1 "fn version" src/pyth.cairo | grep "'" | cut -d "'" -f 2)
42+
if [ "${version1}" != "${version2}" ]; then
43+
>&2 echo Version mismatch in Scarb.toml and src/pyth.cairo
44+
exit 1
45+
fi

target_chains/starknet/contracts/src/pyth.cairo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ mod pyth {
351351
}
352352
}
353353

354+
fn version(self: @ContractState) -> felt252 {
355+
'0.1.0'
356+
}
357+
354358
fn pyth_upgradable_magic(self: @ContractState) -> u32 {
355359
0x97a6f304
356360
}

target_chains/starknet/contracts/src/pyth/interface.cairo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub trait IPyth<T> {
3131
) -> Array<PriceFeed>;
3232
fn get_update_fee(self: @T, data: ByteArray) -> u256;
3333
fn execute_governance_instruction(ref self: T, data: ByteArray);
34+
fn version(self: @T) -> felt252;
3435
fn pyth_upgradable_magic(self: @T) -> u32;
3536
}
3637

0 commit comments

Comments
 (0)