Course Token (ERC 721)

Base NFT token for all the course deployed in the ONGAESHI platform.

Token transfers can be disabled using the transferEnabled flag, where only admins may move NFTs. When transfers are enabled, admins cannot move NFTs. When the adminRepairOnly flag is true, only admins can repair NFTs.

isLended

mapping(uint256 => bytes20) isLended

This mapping connects the tokenID (uint256) with the talentID (bytes20) on the Ongaeshi database.

needRepairMap

mapping(uint256 => bool) needRepairMap

After each process of the talent renting and completing the course, the token is set to broken and requires the owner (sponsor) to repair the token for further use.

repairCost

mapping(uint256 => uint256) repairCost

tokenCID

mapping(uint256 => string) tokenCID

admins

mapping(address => bool) admins

baseURI

string baseURI

This is the URI that will point to the Ongaeshi database. In the future, this baseURI will point to IPFS.

price

currentSupply

supplyLimit

gtAddress

treasury

treasuryFee

transferEnabled

adminRepairOnly

xEmitEvent

onlyAdmin

onlyEnabled

constructor

initialize

addTeacherShares

Caller must be admin wallet. This function can only be called before the first NFT mint. After the first mint, teacher fee distribution is immutable. Shares in the input array must sum to 100% i.e 10000. Teacher Shares must be initialised for before minting to function.

mint

Public minting of ONGAESHI Education NFT, where payment of ONGAESHI Tokens will be made to mint NFT.

Portion of payment will be taken as tresury fee, paid to the treasury address, remainder is distributed among teachers.

Parameters

Name
Type
Description

_amount

uint256

Number of NFTs to mint, request may not exceed supply limit.

mintByAdmin

Admin minting of ONGAESHI Education NFT, Caller must be admin wallet.

Parameters

Name
Type
Description

_amount

uint256

Number of NFTs to mint, request may not exceed supply limit.

_recipient

address

Recipient of newly minted NFTs.

setPrice

Update minting price of NFT, caller must be admin wallet.

Parameters

Name
Type
Description

_newPrice

uint256

New minting price of NFT.

setTreasuryFee

Updates treasury fee, caller must be admin wallet.

Parameters

Name
Type
Description

_treasuryFee

uint256

New treasury fee, e.g. 500 = 5%, 1000 = 10%.

setTreasury

Updates recipient address of treasury fees. Caller must be admin.

Parameters

Name
Type
Description

_treasury

address

New address of treasury.

increaseSupplyLimit

Increase the NFT supply limit by input number. Caller must be admin.

Parameters

Name
Type
Description

_increaseBy

uint256

number to increase supply limit by, e.g supplyLimit 100, increaseBy 5, new supplyLimit = 105.

decreaseSupplyLimit

Decrease the NFT supply limit by input number. Caller must be admin.

Parameters

Name
Type
Description

_decreaseBy

uint256

number to decrease supply limit by, e.g supplyLimit 100, increaseBy 5, new supplyLimit = 95.

lendToken

Record loan status, caller must be Admin.

Parameters

Name
Type
Description

_tokenId

uint256

Token to loan out.

_Id

bytes20

Talent UUID to that is borring the token.

returnToken

Record or Cancel NFT loan, token requires repair after, caller must be Admin.

Parameters

Name
Type
Description

_tokenId

uint256

Loaned token to return.

_repairCost

uint256

Cost to repair token.

_isCancel

bool

Flag, true indicates this is a cancel, false indicates its a return.

breakToken

repairToken

Portion of payment will be taken as tresury fee, paid to the treasury address, remainder is distributed among teachers. adminRepairOnly Flag can disable this function.

repairTokenByAdmin

Repair NFT, caller must be admin wallet. Caller must be admin.

Parameters

Name
Type
Description

_tokenId

uint256

Token to be repaired.

_baseURI

Base URI for computing {tokenURI}. If set, the resulting URI for each token will be the concatenation of the baseURI and the tokenId. Empty by default, can be overridden in child contracts.

setBaseURI

Updates the Base URI for the entire NFT collection.

Parameters

Name
Type
Description

_newBaseURI

string

New base URI.

setTokenURI

Updates the cid for the input token. Caller must be admin.

Parameters

Name
Type
Description

_tokenId

uint256

Token to update cid.

_cid

string

New cid for token.

setTokenURIs

Batch update cid for input tokens. Caller must be admin.

Parameters

Name
Type
Description

_tokenId

uint256[]

Array of tokens to update cid.

_cid

string[]

Array of new cids for token.

tokenURI

See {IERC721Metadata-tokenURI}.

setAdminRepairOnly

Updates adminRepairOnly flag, caller must be admin wallet.

Parameters

Name
Type
Description

_allow

bool

new status of adminRepairOnly flag.

setTransferEnabled

Updates transferEnabled flag, caller must be admin wallet. Caller must be admin.

Parameters

Name
Type
Description

_allow

bool

new status of transferEnabled flag.

setGTAddress

Updates the ONGAESHI token address of this smart contract. Caller must be admin.

Parameters

Name
Type
Description

_gtAddress

address

New ONGAESHI token address.

payTeachers

Function to distribute ONGAESHI tokens according to established teacher shares of this smart contract.

Caller must have sufficient ONGAESHI token balance, and approve this contract for spending input amount.

Parameters

Name
Type
Description

amount

uint256

Amount of ONGAESHI tokens to distribute.

getSubTeachers

Gets the teacher shares data.

setEmitEvent

Updates the contract address for event emitter.

Ensure that this contract has access to emit events on the new event emitter.

Parameters

Name
Type
Description

_emitEventAddr

address

New event emitter contract address.

setAdmin

Set admin status to any wallet, caller must be contract owner.

Parameters

Name
Type
Description

_address

address

Address to set admin status.

_allow

bool

Admin status, true to give admin access, false to revoke.

adminTransferFrom

Admin privilliged TransferFrom function. Caller must be admin.

Parameters

Name
Type
Description

from

address

Address of NFT owner.

to

address

Address of NFT recipient.

tokenId

uint256

Token Id of NFT to be transferred.

transferFrom

See {IERC721-transferFrom}.

safeTransferFrom

See {IERC721-safeTransferFrom}.

safeTransferFrom

See {IERC721-safeTransferFrom}.

Last updated