Skip to content

Commit

Permalink
updates examples directory and removes proxy-consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-de-leon-cll committed Feb 28, 2024
1 parent 4ebc7bb commit 7717098
Show file tree
Hide file tree
Showing 33 changed files with 962 additions and 428 deletions.
2 changes: 2 additions & 0 deletions examples/contracts/aggregator_consumer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
target
.snfoundry_cache/
12 changes: 12 additions & 0 deletions examples/contracts/aggregator_consumer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# TODO: these helper commands may be useful for the deploy script(s)
#
# ACCOUNT_NAME="test-acct"
#
# create-account:
# @sncast account create --name $(ACCOUNT_NAME)
#
# deploy-account:
# @sncast account deploy --name $(ACCOUNT_NAME)

run-script:
@cd ./scripts && sncast script run $(NAME)
27 changes: 27 additions & 0 deletions examples/contracts/aggregator_consumer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Examples

## Overview

## Prerequisites


To get started, ensure that you have the following tools installed on your machine:

- [starknet-foundry (v0.18.0)](https://github.com/foundry-rs/starknet-foundry/releases/tag/v0.18.0)
- [scarb (v2.5.4)](https://github.com/software-mansion/scarb/releases/tag/v2.5.4)

## Running Test Cases

To run all test cases, you can use the following command:

```sh
snforge test
```

## Running Scripts

To run a script, you can use the following command replacing the `NAME` argument with the name of the script to run:

```sh
make run-script NAME=example
```
28 changes: 28 additions & 0 deletions examples/contracts/aggregator_consumer/Scarb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "aggregator_consumer"
version = "0.1.0"
dependencies = [
"chainlink",
"openzeppelin",
"snforge_std",
]

[[package]]
name = "chainlink"
version = "0.1.0"
dependencies = [
"openzeppelin",
]

[[package]]
name = "openzeppelin"
version = "0.9.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.9.0#861fc416f87addbe23a3b47f9d19ab27c10d5dc8"

[[package]]
name = "snforge_std"
version = "0.18.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.18.0#48f909a56b08cbdc5ca6a21a836b0fbc6c36d55b"
20 changes: 20 additions & 0 deletions examples/contracts/aggregator_consumer/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This project was generated using snforge init
#
# https://foundry-rs.github.io/starknet-foundry/appendix/snforge/init.html
#

[package]
name = "aggregator_consumer"
version = "0.1.0"
edition = "2023_11"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.9.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.18.0" }
chainlink = { path = "../../../contracts" }
starknet = "2.5.4"

[[target.starknet-contract]]
casm = true
14 changes: 14 additions & 0 deletions examples/contracts/aggregator_consumer/scripts/Scarb.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "sncast_std"
version = "0.18.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.18.0#48f909a56b08cbdc5ca6a21a836b0fbc6c36d55b"

[[package]]
name = "src"
version = "0.1.0"
dependencies = [
"sncast_std",
]
10 changes: 10 additions & 0 deletions examples/contracts/aggregator_consumer/scripts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "src"
version = "0.1.0"
edition = "2023_11"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.18.0" }
starknet = ">=2.5.4"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use sncast_std::{call, CallResult};

fn main() {
println!("replace this with a deploy script!");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use sncast_std::{call, CallResult};

// The example below uses a contract deployed to the Goerli testnet
fn main() {
let contract_address = 0x7ad10abd2cc24c2e066a2fee1e435cd5fa60a37f9268bfbaf2e98ce5ca3c436;
let call_result = call(contract_address.try_into().unwrap(), 'get_greeting', array![]);
assert(*call_result.data[0] == 'Hello, Starknet!', *call_result.data[0]);
println!("{:?}", call_result);
}
2 changes: 2 additions & 0 deletions examples/contracts/aggregator_consumer/scripts/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mod example;
mod deploy;
8 changes: 8 additions & 0 deletions examples/contracts/aggregator_consumer/snfoundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# A full list of RPC endpoints can be found here:
#
# https://blastapi.io/public-api/starknet
#

[sncast.default]
url = "https://starknet-testnet.public.blastapi.io/rpc/v0_6"

1 change: 1 addition & 0 deletions examples/contracts/aggregator_consumer/src/emergency.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod sequencer_uptime_feed;
Loading

0 comments on commit 7717098

Please sign in to comment.