ConfluxStudio
ConfluxStudio copied to clipboard
Feature request: Add helpers for specifying method argument
In some contracts, constructor or method parameters represent concepts like:
- Amount in Drip,
- Date in epoch time,
- Duration in seconds.
It would be nice if Conflux Studio could provide common conversion utilities, e.g.
- CFX to Drip: When I type 10, it converts it into 10 * 1e18 (
uint256
) - Date to epoch time: When I choose 2020/09/15, it converts it into epoch time (
uint256
) - Duration to seconds: When I input 1 year, it converts it into 365 * 24 * 3600 (
uint256
)
Example:
pragma solidity ^0.5.0;
contract Vault {
address owner;
uint256 unlock_after;
constructor(uint256 duration_s) public payable {
owner = msg.sender;
unlock_after = now + duration_s;
}
function withdraw() public {
require(msg.sender == owner);
require(now >= unlock_after);
msg.sender.transfer(address(this).balance);
}
}
When I try to deploy, I see this:
I think it would be great UX to allow specifying raw input but also provide some utility converters at fields like this (maybe through a dropdown menu).
In v0.4.0 you can select from saved keypairs for type address
. We will add more in future versions.