Smart Contract
Smart Contract
www.BCE.asia
INTRODUCTIONS
Mark Smalley
CEO @ Neuroware.io | Tweet Me: @m_smalley
Urban
Rural
Ocean
SMART CONTRACTS ARE NEITHER SMART NOR CONTRACTUAL
● Even Bitcoin utilizes basic smart contracts (with over 100 script functions)
● Smart contracts are snippets of code stored and executed by the network
● They can perform transactional based events if defined conditions are met
PLATFORMS USED FOR SMART CONTRACT TOKENIZATION PROJECTS
WHAT MAKES ETHEREUM DIFFERENT TO STANDARD STACKED OPs ?
● 2016: 3M+ Ether lost @ DAO (Worth US$80M at time - now US$1B+)
● 2017: 150K Ether lost @ Parity MS leading to US$300M+ frozen
● 2018: 2K Ether lost @ POWH Coin from an integer underflow!
-- Every unit has the same value -- Every unit has different value
-- Currencies, points & commodities -- Shares, titles and other IP
-- ERC20 > ERC223 > ERC777 -- ERC721 > ERC998 > ERC1155
-- ERC223 prevents lost ether -- ERC998 introduced composables
-- ERC777 uses contract registrars -- ERC1155 crypto items standard
SHOUT OUT TO FELLOW MALAYSIANS @ ETHERSCAN.io
THE BENEFITS OF STANDARDIZATION
0x PROTOCOL ADOPTION
contract OpenProxy
{
function ()
{
assembly
{
let result := delegatecall(gas, _impl, add(data, 0x20), mload(data), 0, 0)
let size := returndatasize
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
}
SOLIDITY CODE FOR SPLITTING ETERNAL DATA AND LOGIC
contract TokenStorage {
uint256 internal _totalSupply;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
}
contract TokenLogic {
TokenStorage storage;
storage = TokenStorage(0xStorageContractAddress);
function totalSupply(){
return storage._totalSupply;
}
}
RESULTS
what does www.BCE.asia do ?
COMBINING THE BEST OF BOTH WORLDS ?
The immutability of data remains the same within final contracts ...
SOLIDITY CODE FOR BASIC KEY VALUE STORE WITH PROXY
contract keyValueStore
{
mapping(address => mapping(address => mapping(string => uint))) addressedUints;
function _getUint(address Address, string key) returns(uint)
{
return addressedUints[msg.sender][Address][key];
}
}
contract proxy
{
keyValueStore kv;
function proxy(address keyValueContractAddress){
kv = keyValueStore(keyValueContractAddress);
}
function getUint(address Address, string key) returns(uint){
return kv._getUint(Address, key);
}
}
SOLIDITY CODE FOR SETTING STANDARDS FROM STORED DATA
contract ERC20
{
proxy db;
Token Factories
Trustee
Automated Escrow Services
Trusts
Unit Trusts (Collections)
Distributed Key Value Store P2P Markets
Database Containing ALL Data Allow Users to Utilize Central Bank Services
ERC 20
TOKENS
(fungible)
ERC 721
TOKENS
(non fungible) Actions
Forming Alliances
Get Married
Have Kids
Mine Atoms
Planets Buildings & Vehicles Children Corporation Trade Goods
Maintains its own uniquely named bundles of resources with Generated by any Uniquely named Switch Locations
collection of specific utility function to players and/or 2 players bundle of workers Construct Things
un-mined atoms planet owners consummating and buildings
WHAT’S THE CATCH / COSTS ? -- MORE IMPORTANTLY, HOW WILL IT SCALE ?
WANT TO LEARN MORE ?
[email protected]
www.BCE.asia