IBOX系统核心功能如下:
一、藏品上链
数字藏品简单上链,一键快速发行;
二、藏品分销
有强大推广分销功能,用户变成推销者;
三、多端合一
H5端 小程序端,一套系统自由生成;
四、链上赠予
支持藏品赠予功能,完善用户体验;
五、接口开放
可接入原有APP,小程序等。
以下是iobx系统里藏品单位合成的核心源码
from IBOX import IBOX_ART
import json
# https://etherscan.io/tx/0xbede5e44cc631303a22d066cc269f989469742b5bb6d9a74185e146dab9211e4
# https://mainnet.infura.io/v3/8a264f274fd94de48eb290d35db030ab
# contract address is0x0632aDCab8F12edD3b06F99Dc6078FE1FEDD32B0
from web3 import Web3
my_provider = Web3.HTTPProvider('https://mainnet.infura.io/v3/8a264f274fd94de48eb290d35db030ab')
w3 = Web3(my_provider)
def main():
contract_address = '0x0632aDCab8F12edD3b06F99Dc6078FE1FEDD32B0'
contract_abi = json.load(open('surge.abi', 'r'))
# print(contract_abi)
mycontract = w3.eth.contract(address=contract_address, abi=contract_abi)
name = mycontract.functions.name().call()
print(name)
symbol = mycontract.functions.symbol().call()
print(symbol)
tokenURI = mycontract.functions.tokenURI(1802).call()
print(tokenURI)
pass
if __name__ == '__main__':
main()
使用merkle tree
/// @notice Presale minting verifies callers address is in Merkle Root
/// @param _amountOfTokens Amount of tokens to mint
/// @param _merkleProof Hash of the callers address used to verify the location of that address in the Merkle Root
function presaleMint(uint256 _amountOfTokens, bytes32[] calldata _merkleProof)
external
payable
verifyMaxPerUser(msg.sender, _amountOfTokens)
verifyMaxSupply(_amountOfTokens)
isEnoughEth(_amountOfTokens)
{
require(status == SaleStatus.Presale, "Presale not active");
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), "Not in presale list");
_mintedAmount[msg.sender] += _amountOfTokens;
_safeMint(msg.sender, _amountOfTokens);
}
设置merkle root
/// @notice Set Presale Merkle Root
/// @param _merkleRoot Merkle Root hash
function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
merkleRoot = _merkleRoot;
}