carbonable / carbon-protocol Goto Github PK
View Code? Open in Web Editor NEWCarbon Starknet Protocol written in Cairo.
License: Apache License 2.0
Carbon Starknet Protocol written in Cairo.
License: Apache License 2.0
We do not want protostar releases to impact our CI (and our tests).
We need to specify a fixed version of protostar to counter the current behavior of the install.sh script which installs the latest release.
protostar --version
)A feature is provided by protostar in their install.sh script (source)
Define and Design the Carbonable Offseting Certificate.
Collect and adapt the script from starkvest to ease the deployment.
Note: assign to Bal7hazar
Requirements: benchmark data storage costs from other projects to evaluate the opportuniy
Note: If we decide to keep living with the current situation, we may need to add a remove_from_whitelist
option to keep data as clean as possible and avoid sybil.
Opportunity: By default the storage var of the merkle root will be 0 until an update of the root, we could use this behavior to trigger the fact that the pre-sale is open.
Implement the retrieve of NFTs from a Farming Project Pool during the unlock period
excalidraw - Farming schema
Pausable feature can be useful to freeze a contract under attack for instance.
Implement the deposit of NFTs, received after funding a Project, in a Farming Project Pool.
Deposit one NFT by one NFT.
excalidraw - Farming schema
In the current version it misses protostar install
before the compilation topic
To improve the process and avoid errors, we should try to add the deployment directly in a github action.
Note: we could use github variables to handle protostar version also (improvement of #51)
To ensure consistency between Github repos of Carbonable, a common Github process and setup must be created.
This PR add configuration files of Issues Template and specifics Labels for the Issues
carbonable_labels.json
Implement the deposit of NFTs, received after funding a Project, in a Farming Project Pool.
excalidraw - Farming schema
IPFS data have been reupdated with a carbonable shared account.
IPFS links in assets must be changed accordinly.
To prepare the final deployement we need to chose the latest assets
assets/badges
To handle the case where some reserved spots won't be minted due to unexpected events (such as B2B withdrawal).
As an admin, we want the ability to move some slots from reserved supply into public supply.
To proceed, we need to be able to decrease the reserved supply (only decrease).
Three scenarios:
set_reserved_supply_for_mint(reserved_supply_for_mint : felt)
Which fails if the new reserved_supply_for_mint is ge
to the stored one
Note: less explicit name, easier to use since math are done by the contract
decrease_reserved_supply_for_mint(slots : felt)
Which fails if slots
is gt
than the stored one
Note: more explicit name, admin needs to ensure math before the usage
set_decreased_reserved_supply_for_mint(reserved_supply_for_mint : felt)
Which fails if the new reserved_supply_for_mint is ge
to the stored one
Note: name too long?
With the current state, there is not way for the contract to know if the user has already minted his whitelisted slots or not, allowing the user to mint his slots as much as he wants.
To fix this situation we need a storage variable storing how many slots a user has already minted.
This information is then compared during the whitelist buy to ensure user to not mint more than his whitelisted slots.
Note: with this fix, the gas used to store values are spread by user (which is different from the initial situation where the contract has to setup the whole map before the whitelist sale)
With the current situation, and because NFT project is defined in the constructor of the Minter contract, we have to deploy a new minter contract for each NFT projects.
Allowing to change the nft contract address in the Minter contract will make it reusable for each new projects.
Note: If we decide to implement it, we have to be very careful to reset the merkle root (set to 0, as the initial state of the storage var) to "reset" the whitelist. This reset must be called each time a new NFT project address is set to reduce the risk.
EDIT:
This behavior could also be conflictual with the fact than the token owners can burn their token using the native burn ERC-721 function.
Doing a burn will result in decrease the total_supply and then allow the minter contract to mint a brand new token.
However, this ability will be available only until the minter contract is linked to the NFT contract if we implement this feature.
I don't understand why the following code is actually working:
Here is the IERC20
contract from openzepplin depencency:
@external
func transferFrom{
syscall_ptr : felt*,
pedersen_ptr : HashBuiltin*,
range_check_ptr
}(
sender: felt,
recipient: felt,
amount: Uint256
) -> (success: felt):
ERC20.transfer_from(sender, recipient, amount)
return (TRUE)
And here is a call of the transferFrom
function from here in the mint contract regarding the payment during the buy
function.
# Do ERC20 transfer
let (transfer_success) = IERC20.transferFrom(
payment_token_address, caller, contract_address, amount
)
So basically there are 4 arguments provided where IERC20 expects 3, but actually tests works so I'm probably misunderstanding something.
Implement a function which:
Give the percentage (%) of Carbon Credit of a Project, for a given address, is entitled to receive for the current period.
This function calculates the number of NFTs deposited by the address and returns the amount of Carbon Credit it will receive for this period for this Project.
excalidraw - Farming schema
Whitelist sale open argument is not more required during the deployement of the minter contract.
Deploy script must be adapted accordingly.
In the current version, payment token is provided to the constructor and cannot be modified later (the only way is to deploy a new contract).
To ensure the contract to not be impacted by any external news regarding which payment token we choose, we could add a setter to let the owner chose to change the payment token at any time.
Note sure if there is any political reason to not do this.
As a dev I want to have a doc generated from code
Code relationships : https://github.com/FuzzingLabs/thoth
Doc generator : https://github.com/onlydustxyz/kaaper
Implement the Starkvest Smart Contract to "Claim" the Yield reward (in Stablecoin) for an address.
excalidraw - Farming schema
excalidraw - Farming Interface Claiming
Implement a function to return the number of NFTs locked for a project to be Yield.
excalidraw - Farming schema
Technology:
Upgrade Starkvest contract into Cairo 0.10.1
The propopsition is mainly motivated by the growth of new features and SOC.
Since we are adding more and more contracts and features, it could be interesting to refactor tests.
Integration tests focus on nominal usages by default, this is what aim the test_nominal_cases files of each contract.
We also want to test specific behaviors by chaining actions between contracts, this will be the purpose of the test_specific_cases file of each contract.
Notes:
__setup__
returns for each test files which could slow down tests and increase memory usage__setup__
cheatcodeUnit tests focus on the nominal cases and expect revert tests, since several tests are required per new functionnality (according to the number of exception raised by the function), there is an opportunity to spread tests per functionnality.
Note: A new library.cairo file could store shared code (as the one in the integration tests).
tests/
โโโ integrations/
โ โโโ library.cairo
โ โโโ minter/
โ โ โโโ test_nominal_cases.cairo
โ โ โโโ test_specific_cases.cairo
โ โโโ yielder/
โ โ โโโ test_nominal_cases.cairo
โ โ โโโ test_specific_cases.cairo
โ โโโ .../
โโโ mocks/
โ โโโ erc20.cairo
โโโ units/
โ โโโ library.cairo
โ โโโ minter/
โ โ โโโ test_decrease_reserved_supply_for_mint.cairo
โ โ โโโ test_...
โ โ โโโ test_airdrop.cairo
โ โ โโโ test_whitelist_buy.cairo
โ โ โโโ test_public_buy.cairo
โ โโโ yielder/
โ โ โโโ test_...
Implement Locking and Unlocking Period for Farming Project Pool.
Add any other context or screenshots about the feature request here.
Implement the Certificate Smart Contract to "Claim" the Offset Certificate as Proof of Offseting
excalidraw - Farming schema
Implement the farming feature.
Implement according tests.
func airdrop{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}(
to : felt, quantity : felt
) -> (success : felt):
...
something similar to buy function wihtout ERC20 transfers
...
call mint_n
...
transfer from owner to to
...
end
Implement a function, for an address, to trigger the Offseting of his Carbon Credit.
excalidraw - Farming schema
A 0.10 version has been released, we need to upgrade our contracts accordingly.
All cairo files.
Implement the retrieve of NFTs from a Farming Project Pool during the unlock period
excalidraw - Farming schema
Since the future stacking contract will probably need information about NFT metadata, we will need to have these information on chain and linked to the ERC-721 collection.
Proposition:
A struct that handle attributes
struct Metadata:
member image_url : felt*
member external_url : felt
member description : felt*
member name : felt*
member holder : felt*
member certifier : felt*
member country : felt*
member expiration : felt
member background_color: felt
member animation_url: felt*
member background_color: felt*
member youtube_url: felt*
end
A variable storage to store the metadata
@storage_var
func metadata() -> (res : Metadata):
end
A view for each attribute
@view
func image_url() -> (res : felt*):
end
@view
func external_url() -> (res : felt):
end
All attributes set once in the constructor.
Note: source to existing metadata (Juno contracts)
EDIT - Benchmark about long string management in cairo
According to the #45 PR, we will need to set up all metadata settings into the carbonable project before the ownership transfer.
Inputs could be set in the deploy config file to be updated easily.
EDIT : add an option to avoid to transfer the ownership from admin to minter, such as --no-transfer
In the current situation all deployed contracts are owned by the admin address, therefore we have to manually transfer the ownership of the nft contract from admin to minter contract.
Using starknet invoke
we should be able to handle thise automatically after deployments.
Implement a function to return the number of NFTs locked for a project to be Offset.
excalidraw - Farming schema
A new version of protostar has been released, we must upgrade it.
Github workflows mainly
Implement a function which:
Give the percentage (%) of share of a Project, for a given address, is entitled to receive for the current period.
This function calculates the number of NFTs deposited by the address and returns the amount of share it will receive for this period for this Project.
excalidraw - Farming schema
To secure ownership transfer, we can add a feature to ask the new owner to accept the ownership before processing the transfer.
Feature: OpenZeppelin!505
With the new Cairo 0.10.0 we have to update our smart contract code to keep up-to-date.
Because we will have to go through all the code, it could be a good opportunity to refactor additionnal code according to latest guidelines.
Upgrade the following deps:
Few ideas:
unit_256
checks for all Uint256 inputs (see function in OZ ERC-1155)_iter
suffix for loopsAll cairo files and python files (Cairo 0.10.0 also change python version from 3.7 to 3.9)
OZ released a new version of their contracts according to the new cairo version.
A new version of protostar has been released supporting cairo version.
We need a new release of Cairopen before the migration.
A 0.3.1 protostar version has been released which makes our tests fail.
Market places need contractURI view to display collection metadata
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.