uniworld-io / unichain-core Goto Github PK
View Code? Open in Web Editor NEWFlexible, unlimited scale blockchain network for decentralized marketplace
Home Page: https://uniworld.io/
License: MIT License
Flexible, unlimited scale blockchain network for decentralized marketplace
Home Page: https://uniworld.io/
License: MIT License
Support ListNftApprove:
Because some account don't know that it's delegated to approve some of NFT token, so we should support this listing api
Input:
message NftTokenApproveQuery{
bytes owner_address = 1;
int32 page_size = 2;
int32 page_index = 3;
}
Output:
message NftTokenApproveResult{
bytes owner_address = 1;
int32 page_size = 2;
int32 page_index = 3;
int64 total = 4;
repeated NftToken tokens= 5;
}
How to implement ?
In account-token relation, add indexing field for token approve list:
message NftAccountTokenRelation{
bytes approve_head = 7; //point to head of tokenapprove
bytes approve_tail = 8;//point to tail of tokenapprove
int64 approve_total = 9; //total token
}
Add new account-tokenapprove indexing store with this structure that link to real nft token:
message NftTokenApproveRelation{
bytes owner_address = 1;
bytes token_id = 3;
bytes next = 8;
bytes prev = 9;
}
when approve/disapprove: modify these structure
when listing: load, paging data
Fire event when
Suggestion:
Approve for all NFT suggestion:
messag:
message ApproveForAllNftTokenContract{
bytes owner = 1;
bytes to_address = 2;
bool approve = 3; //true if approve, false if disapprove
}
-Bizz:
Fire event when
Current fee policy
Solution
Burn NFT suggestion:
message:
message BurnNftTokenContract{
bytes owner = 1;
string symbol = 2;
int64 token_id =3;
}
Bizz:
Fire event when
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Limit all NFT contract to block version >= 5 only:
Remove minter from NFT template suggestion:
Bizz:
Renounce(remove itselft) minter from NFT template suggestion:
define new contract type: RenounceNftMinterContract
define new contract input model: RenounceNftMinterContract
message RenounceNftMinterContract{
bytes owner = 2; //owner account, owner of template
string nft_template = 3; //nft template
}
more model look at : see #37
define & declare in actuator factory new actuator for RenounceNftMinterContract
setup contract workflow: parse to json, unpack json to transaction...
define gRPC api, implement gRPC api
create HTTP api: servlet, binding path. for fullnode api ONLY
limit this contract on block version >= 5 only
create capsule wrapper for contract
create contract store
fee = bandwith fee + 0 UNW
also remove minter from account-template indexing store
Bizz:
Suggestion:
Fire event when
Update new fee policy for URC30 token:
Add MIT license file to source code @optimusng
Suggestion:
Create protobuf message format for native NFT:
Criteria:
NftCreateTemplate
NftMintToken
NftRemoveMinter
NftAddMinter
NftRenounceMinter
NftBurnToken
NftApprove
NftApproveForAll
NftTransfer
ListNftTemplate
ListNftToken
ListNftTokenApproveAll
ListNftTokenApprove
GetNftTemplate
GetNftToken
GetNftBalance
GetNftApprovedForAll
PROBLEMS:
repositories { mavenLocal() mavenCentral() // maven { url 'https://repo.spring.io/plugins-release' } maven { url 'https://repo.softmotions.com/repository/softmotions-public'} maven { url 'https://repo.spring.io/snapshot' } }
SOLUTIONS:
Suggestion:
Suggestion:
Template created: MOK, MOK1, MOK3 on testnet
List template got result:
wallet> ListNftTemplate UinLtqgPm9waBdUSVAAzRR6pfBzfQNC4c2 -1 -1
{
"page_size": 20,
"total": 3,
"templates": [
{
"symbol": "MOK",
"name": "monkey",
"total_supply": 100000000000,
"owner": "44e4257594e51b856d87428771a1a9ccdcab8bf5cb",
"last_operation": 1646219814000,
"next": "4d4f4b32"
},
{
"symbol": "MOK2",
"name": "monkey",
"total_supply": 100000000000,
"owner": "44e4257594e51b856d87428771a1a9ccdcab8bf5cb",
"last_operation": 1646219868000,
"next": "4d4f4b33",
"prev": "4d4f4b"
},
{
"symbol": "MOK3",
"name": "monkey",
"total_supply": 100000000000,
"owner": "44e4257594e51b856d87428771a1a9ccdcab8bf5cb",
"last_operation": 1646220390000,
"prev": "4d4f4b32"
}
]
}
load template with empty resault got :
wallet> ListNftTemplate UcTApoAcUFsVkL1xNUdqfqugQugxXEkw2H -1 -1
{
"page_size": 20
}
Fire event when
Describe the bug
Broadcast signed TokenExchangeContract failed on testnet
{ "visible": false, "txID": "41cfd910dbdaceae42e15cd655dfddcd0daf73747918e48ce8a4e7a5774c7839", "raw_data": { "contract": [ { "parameter": { "value": { "amount": 1, "token_name": "AGG4", "owner_address": "44730c18b309a7127efdc523bd3486be3e83a3db86" }, "type_url": "type.googleapis.com/protocol.TokenExchangeContract" }, "type": "ExchangeTokenContract" } ], "ref_block_bytes": "4349", "ref_block_hash": "4daa2cb260e04295", "expiration": 1640280060000, "timestamp": 1640280003821 }, "raw_data_hex": "0a02434922084daa2cb260e0429540e0e0bdc2de2f5a59083e12550a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e546f6b656e45786368616e6765436f6e7472616374121f0a1544730c18b309a7127efdc523bd3486be3e83a3db86120441474734180170eda9bac2de2f", "signature": [ "c1fbdad9e5677ab5156135836ffe9d0915725e66ba884e28117c68ccc6282802a545157f9f12ed11c31c5f274b501aed258496e3571f4c556536506bfdd94afb01" ] }
Error log
17:20:03.967 ERROR qtp1371953731-755] [o.u.c.Wallet Broadcast transaction d0788ee6b9fa5e3888b39c9b2c7fde03fd09412b64d83f05e0bef1d1199024aa failed, miss sig or contract.
Expected behavior
Broadcast tx must be successfull.
Transfer NFT suggestion:
message:
message TransferNftContract{
bytes owner = 1;
bytes to_address = 2;
string symbol = 3;
int64 token_id = 4;
}
Bizz:
transfer nft token to another address
if address not exist: create new address, charge more fee: create new account
limited on role: owner, approval
owner must exist
owner must enough fee: fee = bw fee + 0Unw if account exist or create_new_acc fee + 0 unw + in_system_create_acc_fee
Approve/disapprove NFT suggestion:
message contract:
message ApproveNftTokenContract{
bytes owner = 1;
bytes to_address = 2;
bool approve = 3;
string nft_template = 4;
int64 token_id =5;
}
Bizz:
Support self-locking UNW proposal:
Fire event when
Actuators source code is messy, violate coding convention:
Mint NFT contract workflow suggestion:
Bizz:
Add minter to NFT template suggestion:
define new contract type: addNftMinter
define contract msg:
message AddNftMinterContract{
bytes minter = 1;//minter to add, must exist
bytes owner = 2; //owner account, owner of template
string symbol = 3; //nft template
}
more model look at : see #37
define & declare in actuator factory new actuator for AddNftMinterContract
setup contract workflow: parse to json, unpack json to transaction...
define gRPC api, implement gRPC api
create HTTP api: servlet, binding path. for fullnode api only
limit this contract on block version >= 5 only
create capsule wrapper for contract
create contract store
fee = bandwith fee + 2 UNW
also indexing the minter to account-template contract with flag is_minter = true
Bizz:
Describe the bug
Wrong mapping actuator again block version
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Log
17:24:10.593 INFO [pool-42-thread-1] [DB](SnapshotManager.java:283) flush cost:2, create checkpoint cost:1, refresh cost:1 17:24:10.614 INFO [pool-42-thread-1] [actuator](TokenWithdrawFutureActuatorV3.java:48) TokenWithdrawFutureActuatorV3 owner_address: "D\361\271K6\332\352*\320\312Yj\366\211\320\375)\274\317\330E" token_name: "ssi"
Withdraw future transfer failed:
Describe the bug
Guard account able to receive future send but unable to withdraw
To Reproduce
Steps to reproduce the behavior:
"future_supply": { "total_deal": 2, "lower_time": 1640044800000, "upper_time": 1640131200000, "total_balance": 200000000, "lower_tick": "44efbfbd4b36efbfbdefbfbd2aefbfbdefbfbd596aefbfbdefbfbdefbfbdefbfbd29efbfbdefbfbdefbfbd455f31363430303434383030303030", "upper_tick": "44efbfbd4b36efbfbdefbfbd2aefbfbdefbfbd596aefbfbdefbfbdefbfbdefbfbd29efbfbdefbfbdefbfbd455f31363430313331323030303030" }
13:49:04.816 ERROR [pool-48-thread-1] [actuator](WithdrawFutureActuator.java:77) Account[44f1b94b36daea2ad0ca596af689d0fd29bccfd845] is a guard representative and is not allowed to withdraw Balance java.lang.IllegalArgumentException: Account[44f1b94b36daea2ad0ca596af689d0fd29bccfd845] is a guard representative and is not allowed to withdraw Balance at org.springframework.util.Assert.isTrue(Assert.java:68) at org.unichain.core.actuator.WithdrawFutureActuator.validate(WithdrawFutureActuator.java:72) at org.unichain.core.Wallet.createTransactionCapsule(Wallet.java:330) at org.unichain.core.services.RpcApiService.createTransactionCapsule(RpcApiService.java:173) at org.unichain.core.services.RpcApiService.access$700(RpcApiService.java:59) at org.unichain.core.services.RpcApiService$WalletApi.withdrawFutureTransaction(RpcApiService.java:1315) at org.unichain.api.WalletGrpc$MethodHandlers.invoke(WalletGrpc.java:8638) at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:171) at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:283) at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:707) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
Expected behavior
Dont allowed to send future fund to guard account.
Create NFT template workflow suggestion:
Bizz:
Set fee policy for NFT transactions suggestion:
Suggestion :
Bizz:
Describe the bug
** How to see bug*
*Suggested solution
Describe the bug
Transfer urc30 token got negative amount when transfer amount less than token fee
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should reject transaction.
PROBLEMS:
Owner update URC30 token fee while the other transferring might cause an unwanted charged fee
SUGGESTED SOLUTIONS:
Build new explorer node app frame:
Support ListNftApproveAll:
Because some account don't know that it's delegated to approve all token of other account
Input:
message NftTokenApproveAllQuery{
bytes owner_address = 1;
}
Ouput:
message NftTokenApproveAllResult{
bytes owner_address = 1;
repeated NftAccountTokenRelation approve_list= 2;
}
//use NftAccountTokenRelation but should keep this fields
message NftAccountTokenRelation{
bytes owner = 1; //owner account
int64 total = 4; //total token delegated
}
Suggestion:
input:
message NftTemplateQuery{
bytes owner_address = 1;
int64 page_size = 2;
int64 page_index = 3;
}
output: NFT template info use structure Create NFT google protobuf message format #37
message NftTemplateQueryResult{
bytes owner_address = 1;
int64 page_size = 2;
int64 page_index = 3;
int64 total = 4;
repeated NftTemplate templates = 5;
}
List all available NFT template suggestion:
input:
message NftTemplateQuery{
bytes owner_address = 1;
int64 page_size = 2;
int64 page_index = 3;
}
output: NFT template info use structure Create NFT google protobuf message format #37
message NftTemplateQueryResult{
bytes owner_address = 1;
int64 page_size = 2;
int64 page_index = 3;
int64 total = 4;
repeated NftTemplate templates = 5;
}
public HTTP, gRPC api on both FullNodeAPI & solidApi
Bizz:
Update URC30 life time:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.