Discussion of engineering best practices, design patterns and security for smart contracts
Hi, can someone same me a sample of how to build ERC20 Token with function:
Lock Airdrop Distribution till after Token Sale and Distribute Automatically to members,
Distribute Token to Investors automatically, Only Core Investors are required to sell tokens on the first seven (7) days
after listing of Token on Exchange market.
Reserved Tokens locked for 6 Months.
Lock Team Member tokens for 12 Months.
Presale and Crowdsale Tokens are distributed automatically to buyers ETH Address,
and locked till After Token sale and 7 days after listing on Exchange Market.
Token Sale Prices: $0.001, $0.005, $0.01, $0.05, $0.05
Unsold tokens to be burnt, after crowdsale.
If tokens allocated to a particular tier are not exhausted in sales, it should be rolled over progressively to the next tier.
Thanks for the Help
Hello, I'm Isaque, leading a team to build a P2P crypto AgriFintech in South America, and we are looking for people interested in participate of the project.
Our project is a decentralized investment platform which connects farmers (which ones out of the credit and bank system) to investors (individual or institutional) using the Ethereum platform, smart contracts and web applications.
All the solicitation of loams will be analysed and validated using our data science engine already developed (which uses a combination of satellite images, wheatear forecast, crops informations and parameters and so on).
We are looking forward developers who knows solidity, web3, truffle, javascript, react.js.
Any interested people can send the CV and Portfolio to fewnickels@fewnickels.com
Thanks!
constructor(string memory _firstName, string memory _lastName, string memory _SID) public {
owner = msg.sender;
firstName = _firstName;
lastName = _lastName;
SID = _SID;
}
modifier checkAccess(bool access) {
require(
access == true,
"Access denied"
);
_;
}
function getAccess() public view returns(bool access){
if(msg.sender == owner){
access = true;
}
else{
access = false;
}
}
function getFirstName() public view checkAccess(this.getAccess()) returns (string memory _firstName){
_firstName = firstName;
}
even if the getAccess gives me true, the modifier checkAccess don't let me use the function, someone have some idea?
@MicuEmerson
pragma solidity ^0.5.2;
contract Test {
bool public access;
address public owner;
string public _firstName = "";
constructor() public {
owner = msg.sender;
}
modifier checkAccess(bool _access) {
require(
access == _access,
"Access denied"
);
_;
}
function getAccess() public returns (bool success){
if(msg.sender == owner){
access = true;
}
else{
access = false;
}
}
function getFirstName() public checkAccess(this.getAccess()) returns (string memory firstName){
return (_firstName);
}
function setFirstName(string memory name) public {
_firstName = name;
}
}
Since in your case you are using public view getAccess
and view functions do not modify the state, thus even if you were getting true for that instance, however it was not persisted in the state, thus, you were getting a transaction revert.
I have tested above code on Remix compiler and it works as expected.