Skip to content

sharebravery/adoption-plant-solidity

Repository files navigation

Solidity API

AuthorizedERC20

UnauthorizedAccess

error UnauthorizedAccess()

ExceedsSupplyLimit

error ExceedsSupplyLimit()

OneTimeAuthorizationDone

error OneTimeAuthorizationDone()

constructor

constructor(string name_, string symbol_) public

mint

function mint(address account, uint256 amount) external

仅允许授权的地址调用 mint 函数

Parameters

Name Type Description
account address account
amount uint256 amount

authorizeOnce

function authorizeOnce(address minter) external

一次性授权地址调用 mint 函数

Parameters

Name Type Description
minter address minter

mintableBalance

function mintableBalance() external view returns (uint256)

查询还可以 mint 的余额

PlantMarketV1

BLAST

contract IBlast BLAST

PlantType

enum PlantType {
  Seed,
  Seedling,
  VegetativeVariation,
  Vegetative,
  Flowering,
  Fruiting
}

Plant

struct Plant {
  uint256 plantId;
  enum PlantMarketV1.PlantType plantType;
  uint256 valueEth;
  uint256 adoptedTimestamp;
  address owner;
  bool isAdopted;
  bool isSplit;
}

AdoptionPriceRange

struct AdoptionPriceRange {
  uint256 minEth;
  uint256 maxEth;
  uint8 startTime;
  uint8 endTime;
  uint8 profitDays;
  uint16 profitRate;
  uint256 rewardAmounts;
}

PlantDTO

struct PlantDTO {
  enum PlantMarketV1.PlantType plantType;
  uint256 minEth;
  uint256 maxEth;
}

plants

mapping(uint256 => struct PlantMarketV1.Plant) plants

priceRanges

mapping(enum PlantMarketV1.PlantType => struct PlantMarketV1.AdoptionPriceRange) priceRanges

PlantAdopted

event PlantAdopted(uint256 plantId, address owner, enum PlantMarketV1.PlantType plantType, uint256 adoptionTime)

PlantCreated

event PlantCreated(uint256 plantId, address seller, uint256 price)

PlantListed

event PlantListed(uint256 plantId, address seller, uint256 price)

PlantSold

event PlantSold(uint256 plantId, address buyer, address seller, uint256 price)

PlantIDOverflow

error PlantIDOverflow()

TransferFailed

error TransferFailed()

PlantAlreadyAdopted

error PlantAlreadyAdopted()

PlantAlreadySplit

error PlantAlreadySplit()

InvalidAdoptionPrice

error InvalidAdoptionPrice()

NotAdoptionTime

error NotAdoptionTime()

InvalidPlantID

error InvalidPlantID()

NotOwner

error NotOwner()

PlantNotAdopted

error PlantNotAdopted()

PlantAdoptedError

error PlantAdoptedError()

NotReachingContractTerm

error NotReachingContractTerm()

InvalidPlantType

error InvalidPlantType()

InsufficientTokens

error InsufficientTokens()

OnlyScheduleAdoptionOncePerDay

error OnlyScheduleAdoptionOncePerDay()

NoBalance

error NoBalance()

constructor

constructor(address tokenContractAddress, address _pointsOperator) public

scheduleAdoption

function scheduleAdoption(enum PlantMarketV1.PlantType plantType) external

预约

Parameters

Name Type Description
plantType enum PlantMarketV1.PlantType PlantType

createPlant

function createPlant(struct PlantMarketV1.PlantDTO newPlantDTO, address _owner) public

adoptPlant

function adoptPlant(uint256 _plantId) external payable

_isAdoptionTimeValid

function _isAdoptionTimeValid(enum PlantMarketV1.PlantType plantType) internal view returns (bool)

list

function list(uint256 plantId) public

getLastPlantId

function getLastPlantId() external view returns (uint256)

getPlantInfoById

function getPlantInfoById(uint256 _plantId) public view returns (uint256 plantId, enum PlantMarketV1.PlantType plantType, uint256 valueEth, uint256 adoptedTimestamp, address owner, bool isAdopted, bool isSplit)

getUserAdoptionRecordPlantIds

function getUserAdoptionRecordPlantIds(address _user) public view returns (uint256[])

获取用户曾经拥有的植物ID

Parameters

Name Type Description
_user address 拥有者

getUserAdoptedCurrentPlants

function getUserAdoptedCurrentPlants(address _user, bool includeSplit) external view returns (struct PlantMarketV1.Plant[])

获取用户当前领养的植物

Parameters

Name Type Description
_user address owner
includeSplit bool 是否分裂

getMarketListings

function getMarketListings() external view returns (struct PlantMarketV1.Plant[])

claimMyContractsGas

function claimMyContractsGas() external

receive

receive() external payable

withdraw

function withdraw() external

IBlast

configureClaimableGas

function configureClaimableGas() external

claimAllGas

function claimAllGas(address contractAddress, address recipient) external returns (uint256)

IBlastPoints

configurePointsOperator

function configurePointsOperator(address operator) external

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published