Methods

Learn custom methods of the Gluwacoin standard

Gluwacoin provides every standard ERC20 token function and, additionally, eight custom functions for circulation control, Etherless transfer, and non-custodial exchange.

Circulation Control Functions

The contract owner of Gluwacoin can control the supply creating or destroying Gluwacoins.

mint

Reserved for the contract owner. Creates new Gluwacoins and transfers them to a designated address.

function mint(address _to, uint256 _value) public onlyOwner returns (bool success)

burn

Reserved for the contract owner. Removes Gluwacoins the owner holds from the circulation.

function burn(uint256 _value) public onlyOwner returns (bool success)

Etherless Transfer Functions

Gluwacoin standard supports Etherless transfer for Gluwacoin users. Instead of paying gas to transfer Gluwacoin, a user pays a transfer fee in Gluwacoin to the contract owner.

transfer

A standard ERC20 function but with _fee,_nonce, and _sigas extra parameters. _feeis a transfer fee amount in Gluwacoin, which the sender will pay for the transaction. _sig is a signature created by signing the transfer information with the sender’s private key. Anyone can initiate the transfer for the sender by calling the Etherless Transfer function with the transfer information and the signature. The caller will have to pay the gas for calling the function.

function transfer(address _from, address _to, uint256 _value, uint256 _fee, uint256 _nonce, bytes memory _sig) public returns (bool success)

Non-custodial Exchange Functions

Gluwacoin supports functions for non-custodial exchange use cases. Instead of trusting a 3rd party to hold Gluwacoins for an exchange, a user can request the 3rd party to lock Gluwacoins at the user’s account instead. The locked Gluwacoins are called a reserve and can only be released to the pre-designated receiver or unlocked back to the sender.

Note that the exchange can happen not only between Gluwacoins but also with other cryptocurrencies. If a cryptocurrency supports features equivalent to the Gluwacoin non-custodial exchange functions, it is compatible. For instance, Bitcoin is compatible with Gluwacoin non-custodial exchange when utilizing a 2-to-3 multi-sig wallet.

reserve

Creates a reserve in _from address. The amount of the reserve is _amount and each reserve has _nonce which is unique together with _from . Assigns receiver's address _to and the validator's address _executor._expiryBlockNum specifies when the _from address can reclaim the reserve in case the reserve is unused. _sig is a signature created by signing the transfer information with the _from address' private key.

function reserve(address _from, address _to, address _executor, uint256 _amount, uint256 _fee, uint256 _nonce, uint256 _expiryBlockNum, bytes memory _sig) public returns (bool success)

execute

Releases a fund reserved in _sender address. The reserve is specified by _nonce. The released fund is transferred to _to address. Reserved for the _executor. Note that _to and _executor are pre-determined when the reserve was created.

function execute(address _sender, uint256 _nonce) public returns (bool success)

reclaim

Returns a fund reserved in _sender address. The reserve is specified by _nonce. The fund is transferred to _from address. Reserved for the _from and _executor. While _executor can call the function any time, _from can only call after _expiryBlockNum. Note that _from, _executor, and _expiryBlockNum are pre-determined when the reserve was created.

function reclaim(address _sender, uint256 _nonce) public returns (bool success)

Last updated