Wrapped Hive v2.0 - Open sourcing - Part 1 - Solidity

Wrapped Hive

Open Source
Part 1 - Solidity

wHE-token.jpg
original image source

It's been some time since my last Wrapped Hive update, and I'm a little behind schedule (~1 week), but I have some exciting news to share.

The first part of our code is now open source and ready for review by fellow devs. This includes both wHive token contract and multi-signature smart contract. Both of them are written in solidity.

Multi-signatureContract

Code: https://github.com/fbslo/multisignature-contract

While Hive is pretty generous with 40 account auths possible, Ethereum can be more expensive, while in theory there is no limit (except gas per block), it can get quite expensive. Here is some benchmarking I did (this is cost for one hive-to-whive converison):

# of ValidatorsGas costCost in ETH @ 100 gweiCost in USD (ETH @ 1,966)
10400,223 gas0.040022378,69
20692,550 gas0.069255136,16
301,015,056 gas0.1015056199,56

Transaction fee also depends on network congestion, if the gas price is 20 gwei, the fee will be 80% lower than if it's 100 gwei.

While $200 is very high for someone who is wrapping 100 HIVE, it's probably acceptable for someone who is wrapping 1,000,000 HIVE.

I expect wHIVE network to be the "backbone", while smaller centralized bridges can be used to wrap smaller amounts (similar to Hive-engine and LeoDex) with lower fees.

Token Contract

Code: https://github.com/fbslo/token-contract

It's a standard mintable & burnable OpenZeppeling ERC20 contract, but it's extended with 2 additional functions and 1 event convert(uint256 amount, string username):

convertToken (contract.sol#L955)

function convertToken(uint256 amount, string memory username) public {
    _burn(_msgSender(), amount);
    emit convert(amount, username);
}

convertTokenFrom (contract.sol#L967)

function convertTokenFrom(
    address account,
    uint256 amount,
    string memory username
) public {
    _burnFrom(account, amount);
    emit convert(amount, username);
}

These functions add an option to include hive username to burn transaction, so validator nodes can transfer unwrapped HIVE.

@fbslo

If you like my work, please support me by voting for my Hive Witness!
Witness announcement

H2
H3
H4
3 columns
2 columns
1 column
5 Comments
Ecency