The smart contract of the Qitmeer on the Ethereum network
The destruction contract is used to permanently lock HLC tokens and record the destruction address. When Meer is online, the corresponding tokens can be returned.
- symbol : Quantity of token destroyed;
- token : token contract address;
constructor (address _token ) public {
symbol = 0;
token = _token;
}
- _sender : Destroyed users address;
- value : Destroyed token number , need approve destroy contract number;
function burn( address _sender, uint256 value ) public onlyOwner( _sender ) {
require(ERC20(token).transferFrom( _sender, address(this), value), 'transferFrom erro');
burnList[_sender].amount = burnList[_sender].amount.add(value);
symbol = symbol.add(value);
emit Burn( _sender, value);
}
Batch operations can be used confirmBatchTxid.
- _meerPKH: meer publickey hash 160;
function fetchMeer( bytes20 _meerPKH ) public {
burnList[msg.sender].redeemPublicHash = _meerPKH;
}
- getSenderNum: Query Recycle Address number;
- getSender: Query destroyed users meer address;
function getSenderNum( address _sender ) view public returns(uint) {
return burnList[_sender].redeem.length;
}
function getSender( address _sender, uint i ) view public returns( bytes20 meerPublickeyHash, bytes32 txId, uint256 amount ) {
BurnList memory burn = burnList[_sender];
return ( burn.redeem[i].meerPKH, burn.redeem[i].txId, burn.redeem[i].amount );
}
After Main Network Stabilization, After returning the Meer to the user, upload the transaction certificate to the contract.
- _sender: Destroyed users address;
- txId: meer txid;
- meerNum: Number of meers returned to users;
function confirmTxid( address _sender, bytes32 txId, uint256 meerNum ) public only(owner) {
BurnList memory burner = burnList[_sender];
require( burner.amount > 0 );
require( burner.redeemPublicHash != 0x0 );
burnList[_sender].redeem.push(
Redeem(
burner.redeemPublicHash,
txId,
meerNum
)
);
burnList[_sender].amount = 0;
}
- network: ropsten;
- test token: 0xD72270bC2656C58b7B9d1Cd9935b1e82adc48aaa
- test destroy contract address: 0x36f1e09232d3F5bd4428216761cC18D6FE60F67A
- network: main;
- token: 0x58c69ed6cd6887c0225D1FcCEcC055127843c69b
- destroy contract address: 0x126720EC10F5aFbf2184146621F183CAE317F573
- network: ropsten;
- test token: 0x84F274225D7Db9DD868AB1D905173Bb7990BCD0f
- test bank contract address: 0x6C4AeE8bA5917ED87b2eab9BE01a56AF94707138