-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
364 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#[starknet::interface] | ||
trait IMetadataDescriptor<TContractState> { | ||
fn construct_uri(self: @TContractState, token_id: u256) -> Span<felt252>; | ||
} | ||
|
||
#[starknet::contract] | ||
mod KarathuruCPV3Uri { | ||
use starknet::{get_contract_address, ContractAddress}; | ||
|
||
use metadata::metadata::vintages::template::{svg, storage, data as template_data}; | ||
use metadata::metadata::vintages::template::json::generate_json; | ||
use metadata::metadata::vintages::karathuru::static::get_static_data; | ||
|
||
use openzeppelin::introspection::interface::{ISRC5Dispatcher, ISRC5DispatcherTrait, ISRC5_ID}; | ||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[external(v0)] | ||
impl CPV3Metadata of super::IMetadataDescriptor<ContractState> { | ||
fn construct_uri(self: @ContractState, token_id: u256) -> Span<felt252> { | ||
// [Check] calling contract is compatible | ||
let contract = get_contract_address(); | ||
self.compatible(contract); | ||
let static_data = get_static_data(); | ||
generate_json(contract, token_id, static_data) | ||
} | ||
} | ||
#[generate_trait] | ||
impl CPV3MetadataInternal of IInternal { | ||
fn compatible(self: @ContractState, contract_address: ContractAddress) { | ||
let src5 = ISRC5Dispatcher { contract_address }; | ||
let is_SRC5 = src5.supports_interface(ISRC5_ID); | ||
assert(src5.supports_interface(ISRC5_ID), 'ISRC5 not supported'); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
use metadata::metadata::common::models::{ProjectStaticData, String, Shortstring}; | ||
|
||
const NAME: Shortstring = 'Karathuru'; | ||
const DEVELOPER: Shortstring = 'Wordview Intl Foundation'; | ||
const CERTIFIER: Shortstring = 'Verra'; | ||
const AREA: u32 = 86; | ||
const COUNTRY: Shortstring = 'Myanmar'; | ||
const END_YEAR: u32 = 2047; // get from project | ||
const END_MONTH: u8 = 12; // get from project | ||
const DURATION_IN_YEARS: u32 = consteval_int!(2047 - 2024); // get from project | ||
const TOTAL_CU: u64 = 70589; // get from project | ||
const PROJECTED_CU: u64 = 70589; // get from project | ||
const COLOR: Shortstring = 'Blue'; | ||
const TYPE: Shortstring = 'ARR'; | ||
const CATEGORY: Shortstring = 'Mangrove'; | ||
const SOURCE: Shortstring = 'Carbonable'; | ||
const PAUSED: u8 = 0; | ||
|
||
#[inline(always)] | ||
fn get_sdgs_() -> Span<u8> { | ||
array![4, 5, 8, 13, 14, 15].span() | ||
} | ||
|
||
#[inline(always)] | ||
fn get_static_data() -> ProjectStaticData { | ||
ProjectStaticData { | ||
name: array![NAME].span(), | ||
description: get_description_(), | ||
developer: array![DEVELOPER].span(), | ||
certifier: array![CERTIFIER].span(), | ||
area: AREA, | ||
country: array![COUNTRY].span(), | ||
end_year: END_YEAR, | ||
end_month: END_MONTH, | ||
duration_in_years: DURATION_IN_YEARS, | ||
total_cu: TOTAL_CU, | ||
projected_cu: PROJECTED_CU, | ||
color: array![COLOR].span(), | ||
type_: array![TYPE].span(), | ||
category: array![CATEGORY].span(), | ||
source: array![SOURCE].span(), | ||
sdgs: get_sdgs_(), | ||
background_component: 'bg.Karathuru.jpg.b64', | ||
external_url: get_external_url_(), | ||
paused: PAUSED, | ||
} | ||
} | ||
|
||
#[inline(always)] | ||
fn get_external_url_() -> Span<felt252> { | ||
array!['https://app.carbonable.io/', 'launchpad/', 'mangroves-regeneration-', 'karathuru'] | ||
.span() | ||
} | ||
|
||
#[inline(always)] | ||
fn get_description_() -> Span<felt252> { | ||
let mut data = Default::default(); | ||
add_description_(ref data); | ||
data.span() | ||
} | ||
|
||
#[inline(always)] | ||
fn add_description_(ref data: Array<felt252>) { | ||
data.append('The project involves the'); | ||
data.append(' regeneration of 228 ha in 2023'); | ||
data.append(' with the planting of 570,000'); | ||
data.append(' trees (2,500 per ha), and the'); | ||
data.append(' restoration of a carbon sink t'); | ||
data.append('hat will result in a forecasted'); | ||
data.append(' amount of 374,285 certified'); | ||
data.append(' carbon units amongst which'); | ||
data.append(' 187,142 Carbon Units will be'); | ||
data.append(' reserved for investors and the'); | ||
data.append(' other half to local'); | ||
data.append(' communities.'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#[starknet::interface] | ||
trait IMetadataDescriptor<TContractState> { | ||
fn construct_uri(self: @TContractState, token_id: u256) -> Span<felt252>; | ||
} | ||
|
||
#[starknet::contract] | ||
mod LasDeliciasCPV3Uri { | ||
use starknet::{get_contract_address, ContractAddress}; | ||
|
||
use metadata::metadata::vintages::template::{svg, storage, data as template_data}; | ||
use metadata::metadata::vintages::template::json::generate_json; | ||
use metadata::metadata::vintages::las_delicias::static::get_static_data; | ||
|
||
use debug::PrintTrait; | ||
|
||
use openzeppelin::introspection::interface::{ISRC5Dispatcher, ISRC5DispatcherTrait, ISRC5_ID}; | ||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[external(v0)] | ||
impl CPV3Metadata of super::IMetadataDescriptor<ContractState> { | ||
fn construct_uri(self: @ContractState, token_id: u256) -> Span<felt252> { | ||
// [Check] calling contract is compatible | ||
let contract = get_contract_address(); | ||
self.compatible(contract); | ||
let static_data = get_static_data(); | ||
generate_json(contract, token_id, static_data) | ||
} | ||
} | ||
#[generate_trait] | ||
impl CPV3MetadataInternal of IInternal { | ||
fn compatible(self: @ContractState, contract_address: ContractAddress) { | ||
let src5 = ISRC5Dispatcher { contract_address }; | ||
let is_SRC5 = src5.supports_interface(ISRC5_ID); | ||
assert(src5.supports_interface(ISRC5_ID), 'ISRC5 not supported'); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
use metadata::metadata::common::models::{ProjectStaticData, String, Shortstring}; | ||
|
||
const NAME: Shortstring = 'Las Delicias'; | ||
const DEVELOPER: Shortstring = 'Fundacion Naturaleza Panama'; | ||
const CERTIFIER: Shortstring = 'Wildsense'; | ||
const AREA: u32 = 18; | ||
const COUNTRY: Shortstring = 'Panama'; | ||
const END_YEAR: u32 = 2042; // get from project | ||
const END_MONTH: u8 = 12; // get from project | ||
const DURATION_IN_YEARS: u32 = consteval_int!(2042 - 2022); // get from project | ||
const TOTAL_CU: u64 = 3603; // get from project | ||
const PROJECTED_CU: u64 = 3603; // get from project | ||
const COLOR: Shortstring = 'Blue'; | ||
const TYPE: Shortstring = 'ARR'; | ||
const CATEGORY: Shortstring = 'Mangrove'; | ||
const SOURCE: Shortstring = 'Carbonable'; | ||
const PAUSED: u8 = 0; | ||
|
||
#[inline(always)] | ||
fn get_sdgs_() -> Span<u8> { | ||
array![8, 13, 14, 15].span() | ||
} | ||
|
||
#[inline(always)] | ||
fn get_static_data() -> ProjectStaticData { | ||
ProjectStaticData { | ||
name: array![NAME].span(), | ||
description: get_description_(), | ||
developer: array![DEVELOPER].span(), | ||
certifier: array![CERTIFIER].span(), | ||
area: AREA, | ||
country: array![COUNTRY].span(), | ||
end_year: END_YEAR, | ||
end_month: END_MONTH, | ||
duration_in_years: DURATION_IN_YEARS, | ||
total_cu: TOTAL_CU, | ||
projected_cu: PROJECTED_CU, | ||
color: array![COLOR].span(), | ||
type_: array![TYPE].span(), | ||
category: array![CATEGORY].span(), | ||
source: array![SOURCE].span(), | ||
sdgs: get_sdgs_(), | ||
background_component: 'bg.LasDelicias.jpg.b64', | ||
external_url: get_external_url_(), | ||
paused: PAUSED, | ||
} | ||
} | ||
|
||
#[inline(always)] | ||
fn get_external_url_() -> Span<felt252> { | ||
array![ | ||
'https://app.carbonable.io/', 'launchpad/', 'mangroves-regeneration-', 'las-delicias-panama' | ||
] | ||
.span() | ||
} | ||
|
||
#[inline(always)] | ||
fn get_description_() -> Span<felt252> { | ||
let mut data = Default::default(); | ||
add_description_(ref data); | ||
data.span() | ||
} | ||
|
||
#[inline(always)] | ||
fn add_description_(ref data: Array<felt252>) { | ||
data.append('Carbonable\'s Las Delicias NFTs'); | ||
data.append(': Dive into Nature\'s VIP Club!'); | ||
data.append(' Unlock a world of green and bl'); | ||
data.append('ue with Panama\'s mangrove rest'); | ||
data.append('orers! By securing an NFT, you'); | ||
data.append('\'re not only backing an eco-mi'); | ||
data.append('ssion, but you\'re also claimin'); | ||
data.append('g prime carbon credits. Stay ah'); | ||
data.append('ead, make waves, and grab yours'); | ||
data.append(' now. Nature\'s red carpet is r'); | ||
data.append('olling out!'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#[starknet::interface] | ||
trait IMetadataDescriptor<TContractState> { | ||
fn construct_uri(self: @TContractState, token_id: u256) -> Span<felt252>; | ||
} | ||
|
||
#[starknet::contract] | ||
mod ManjarisoaCPV3Uri { | ||
use starknet::{get_contract_address, ContractAddress}; | ||
|
||
use metadata::metadata::vintages::template::{svg, storage, data as template_data}; | ||
use metadata::metadata::vintages::template::json::generate_json; | ||
use metadata::metadata::vintages::manjarisoa::static::get_static_data; | ||
|
||
use debug::PrintTrait; | ||
|
||
use openzeppelin::introspection::interface::{ISRC5Dispatcher, ISRC5DispatcherTrait, ISRC5_ID}; | ||
|
||
#[storage] | ||
struct Storage {} | ||
|
||
#[external(v0)] | ||
impl CPV3Metadata of super::IMetadataDescriptor<ContractState> { | ||
fn construct_uri(self: @ContractState, token_id: u256) -> Span<felt252> { | ||
// [Check] calling contract is compatible | ||
let contract = get_contract_address(); | ||
self.compatible(contract); | ||
let static_data = get_static_data(); | ||
generate_json(contract, token_id, static_data) | ||
} | ||
} | ||
#[generate_trait] | ||
impl CPV3MetadataInternal of IInternal { | ||
fn compatible(self: @ContractState, contract_address: ContractAddress) { | ||
let src5 = ISRC5Dispatcher { contract_address }; | ||
let is_SRC5 = src5.supports_interface(ISRC5_ID); | ||
assert(src5.supports_interface(ISRC5_ID), 'ISRC5 not supported'); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
use metadata::metadata::common::models::{ProjectStaticData, String, Shortstring}; | ||
|
||
const NAME: Shortstring = 'Manjarisoa'; | ||
const DEVELOPER: Shortstring = 'Forest Calling Action'; | ||
const CERTIFIER: Shortstring = 'Wildsense'; | ||
const AREA: u32 = 20; | ||
const COUNTRY: Shortstring = 'Madagascar'; | ||
const END_YEAR: u32 = 2043; // get from project | ||
const END_MONTH: u8 = 12; // get from project | ||
const DURATION_IN_YEARS: u32 = consteval_int!(2043 - 2022); // get from project | ||
const TOTAL_CU: u64 = 8000; // get from project | ||
const PROJECTED_CU: u64 = 8000; // get from project | ||
const COLOR: Shortstring = 'Green'; | ||
const TYPE: Shortstring = 'ARR'; | ||
const CATEGORY: Shortstring = 'Forest'; | ||
const SOURCE: Shortstring = 'Carbonable'; | ||
const PAUSED: u8 = 1; | ||
|
||
#[inline(always)] | ||
fn get_sdgs_() -> Span<u8> { | ||
array![8, 13, 15].span() | ||
} | ||
|
||
#[inline(always)] | ||
fn get_static_data() -> ProjectStaticData { | ||
ProjectStaticData { | ||
name: array![NAME].span(), | ||
description: get_description_(), | ||
developer: array![DEVELOPER].span(), | ||
certifier: array![CERTIFIER].span(), | ||
area: AREA, | ||
country: array![COUNTRY].span(), | ||
end_year: END_YEAR, | ||
end_month: END_MONTH, | ||
duration_in_years: DURATION_IN_YEARS, | ||
total_cu: TOTAL_CU, | ||
projected_cu: PROJECTED_CU, | ||
color: array![COLOR].span(), | ||
type_: array![TYPE].span(), | ||
category: array![CATEGORY].span(), | ||
source: array![SOURCE].span(), | ||
sdgs: get_sdgs_(), | ||
background_component: 'bg.Manjarisoa.jpg.b64', | ||
external_url: get_external_url_(), | ||
paused: PAUSED, | ||
} | ||
} | ||
|
||
#[inline(always)] | ||
fn get_external_url_() -> Span<felt252> { | ||
array!['https://app.carbonable.io/', 'launchpad/', 'forest-regeneration-', 'madagascar'].span() | ||
} | ||
|
||
#[inline(always)] | ||
fn get_description_() -> Span<felt252> { | ||
let mut data = Default::default(); | ||
add_description_(ref data); | ||
data.span() | ||
} | ||
|
||
#[inline(always)] | ||
fn add_description_(ref data: Array<felt252>) { | ||
data.append('Carbonable\'s Manjarisoa NFTs:'); | ||
data.append(' Join the forest-saving brigade'); | ||
data.append(' in Madagascar! Step into Madag'); | ||
data.append('ascar\'s vibrant forest symphon'); | ||
data.append('y! Your NFT not only champions'); | ||
data.append(' a biodiversity-rich mission bu'); | ||
data.append('t also earns you top-tier carbo'); | ||
data.append('n credits. Get ready for nature'); | ||
data.append('\'s grand performance, starring'); | ||
data.append(' lemurs, birds, and frogs. Natu'); | ||
data.append('re\'s encore is calling-be there'); | ||
data.append('!'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters