ICarbonmark

Git Source

Functions

createListing

This function creates a new listing and returns the resulting listing ID

function createListing(address token, uint256 amount, uint256 unitPrice, uint256 minFillAmount, uint256 deadline)
    external
    returns (bytes32 id);

Parameters

NameTypeDescription
tokenaddressThe token being listed
amountuint256The amount to be listed
unitPriceuint256The unit price in USDC to list. Should be provided in full form so a price of 2.5 USDC = input of 2500000
minFillAmountuint256The minimum number of tons needed to be purchased to fill this listing
deadlineuint256The block timestamp at which this listing will expire

Returns

NameTypeDescription
idbytes32The ID of the listing that was created

fillListing

This function fills an existing listing

function fillListing(
    bytes32 id,
    address listingAccount,
    address listingToken,
    uint256 listingUnitPrice,
    uint256 amount,
    uint256 maxCost
) external;

Parameters

NameTypeDescription
idbytes32The listing ID to update
listingAccountaddressThe account that created the listing you are filling
listingTokenaddressThe token you are swapping for
listingUnitPriceuint256The unit price per token to fill the listing
amountuint256Amount of the listing to fill
maxCostuint256Maximum cost in USDC for filling this listing

getListingOwner

function getListingOwner(bytes32 id) external view returns (address);

getUnitPrice

function getUnitPrice(bytes32 id) external view returns (uint256);

getRemainingAmount

function getRemainingAmount(bytes32 id) external view returns (uint256);

getListingDeadline

function getListingDeadline(bytes32 id) external view returns (uint256);

Structs

CreditListing

Struct containing all of the detail information needed to fill a listing

struct CreditListing {
    bytes32 id;
    address account;
    address token;
    uint256 tokenId;
    uint256 remainingAmount;
    uint256 unitPrice;
}

Properties

NameTypeDescription
idbytes32
accountaddressEthereum address of the account who owns the listing
tokenaddressEthereum address of the token being listing
tokenIduint256
remainingAmountuint256Remaining amount that can be filled on this listing
unitPriceuint256The unit price in USDC of the listing