Skip to content

The smart contract of the Qitmeer on the Ethereum network

Notifications You must be signed in to change notification settings

Qitmeer/meerbank-eth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meerbank-eth

The smart contract of the Qitmeer on the Ethereum network

Meer-Destroy

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.

Contract creation

  • symbol : Quantity of token destroyed;
  • token : token contract address;
constructor (address _token ) public {
    symbol = 0;
    token = _token;
}

Burn

  • _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);
}

Confirm meer Address

Batch operations can be used confirmBatchTxid.

  • _meerPKH: meer publickey hash 160;
function fetchMeer( bytes20 _meerPKH ) public {
    burnList[msg.sender].redeemPublicHash = _meerPKH;
}

Query the Recycle Address of the User

  • 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 );
}

Upload transaction id

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;
}

Test

Main

Meer-Bank

Test

About

The smart contract of the Qitmeer on the Ethereum network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published