Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carbon Protocol v3 - Components version #1

Merged
merged 4 commits into from
Jan 26, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ keystore.json
__pycache__
env
.env
.env.*
test.*

# starknet
Expand All @@ -26,4 +27,5 @@ build
.DS_Store

tmp
.tmp*
.tmp*
old*
5 changes: 3 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ version = "0.1.0"
starknet = ">=2.3.1"
alexandria_storage = { git = "https://github.com/tekkac/alexandria", branch = "feat/interpolation-fast" }
alexandria_numeric = { git = "https://github.com/tekkac/alexandria", branch = "feat/interpolation-fast" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.7.0" }
token = { git = "https://github.com/dojoengine/origami.git", rev = "60d8eb7875d4c0367d75a337b0ce607ee5992e4b" }
openzeppelin = { git = "https://github.com/cloudvenger/cairo-contracts.git", rev = "fd41fdb9d04a701b2353c4cd0a8bd19f3139e88a" }

[[target.starknet-contract]]
sierra = true
casm = false
32 changes: 14 additions & 18 deletions scripts/deploy_project.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash
source ../.env

SIERRA_FILE=../target/dev/carbon_Project.sierra.json
NAME=0x436172626f6e5f54657374
SIERRA_FILE=../target/dev/carbon_v3_Project.contract_class.json
NAME="TokCC"
SYMBOL="CARBT"
DECIMALS=6
OWNER=0x05bB7458b87FaaA41303A69B771ae26235F28b79aBD5FA1C451C43461DFE1438
SLOT=1
PROJECT_VALUE=100000000
TIMES="2 1688169600 1719792000"
ABSORPTIONS="2 0 2746197000000"
OWNER=0x01e2F67d8132831f210E19c5Ee0197aA134308e16F7f284bBa2c72E28FC464D2
PROJECT_VALUE=121099000000
TIMES="21 1674579600 1706115600 1737738000 1769274000 1800810000 1832346000 1863968400 1895504400 1927040400 1958576400 1990198800 2021734800 2053270800 2084806800 2116429200 2147965200 2179501200 2211037200 2242659600 2274195600 2305731600"
ABSORPTIONS="21 0 29609535 47991466 88828605 118438140 370922507 623406874 875891241 1128375608 1380859976 2076175721 2771491466 3466807212 4162122957 4857438703 5552754448 6248070193 6943385939 7638701684 8000000000 8000000000"
TON_EQUIVALENT=1000000

# build the solution
Expand Down Expand Up @@ -45,7 +44,7 @@ deploy() {
class_hash=$(declare | tail -n 1)
sleep 5

output=$(starkli deploy $class_hash "$NAME" str:"$SYMBOL" "$DECIMALS" "$OWNER" --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)
output=$(starkli deploy $class_hash str:"$NAME" str:"$SYMBOL" "$OWNER" --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)

if [[ $output == *"Error"* ]]; then
echo "Error: $output"
Expand All @@ -57,26 +56,23 @@ deploy() {
}

setup() {
contract=$(deploy)
sleep 5

output=$(starkli invoke $contract set_project_value u256:$SLOT u256:$PROJECT_VALUE --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)
if [[ $output == *"Error"* ]]; then
echo "Error: $output"
exit 1
fi
#contract=$(deploy)
#sleep 5
contract="0x0348de44e0109e364e15c85407950a6ed39393a49396ca83c02516c4390f81e8"

output=$(starkli invoke $contract set_certifier u256:$SLOT $OWNER --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)
output=$(starkli invoke $contract set_project_value u256:$PROJECT_VALUE --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)
if [[ $output == *"Error"* ]]; then
echo "Error: $output"
exit 1
fi
echo "Success: $output"

output=$(starkli invoke $contract set_absorptions u256:$SLOT $TIMES $ABSORPTIONS $TON_EQUIVALENT --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)
output=$(starkli invoke $contract set_absorptions $TIMES $ABSORPTIONS $TON_EQUIVALENT --keystore-password $KEYSTORE_PASSWORD --watch 2>&1)
if [[ $output == *"Error"* ]]; then
echo "Error: $output"
exit 1
fi
echo "Success: $output"

echo $contract
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/absorber.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mod module;
mod interface;

use module::AbsorberComponent;
5 changes: 1 addition & 4 deletions src/components/absorber/interface.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ trait IAbsorber<TContractState> {

/// Setup the absorption curve parameters.
fn set_absorptions(
ref self: TContractState,
times: Span<u64>,
absorptions: Span<u64>,
ton_equivalent: u64
ref self: TContractState, times: Span<u64>, absorptions: Span<u64>, ton_equivalent: u64
);

/// Setup the project value for the given slot.
Expand Down
Loading