EVM-JRPC calls Vision native functions
Notice
- Effective version: ultima1.2.0 (2022H2 online)
- The contract code internal call 0x8888888888888888888888888888888888888888 will not take effect.
- The native API call 0x8888888888888888888888888888888888888888 will not take effect.
Introduce
Metamask is an Ethereum wallet that is widely used. In order to facilitate users to use Vision, Vision is not only compatible with some of the main interfaces of metamask, but also compatible with the native functions of vision:
The transactions with signature:
FreezeBalanceContract (phoyon/entropy/fvguarangee/CommunityVoting), UnfreezeBalanceContract (phoyon/entropy/fvguarangee/CommunityVoting), WithdrawBalanceContract, VoteWitnessContract, WitnessCreateContract, WitnessUpdateContract, UpdateBrokerageContract, ProposalCreateContract, ProposalApproveContract, ProposalDeleteContract, AccountUpdateContract.
The transactions with unsignature:
GetReward, GetBrokerage, GetMaintenanceTime.
API
The vision native transaction is compatible with evm's JRPC interface. Note these two methods:
eth_sendRawTransaction (creates a new message calling transaction or contract for a signed transaction)
eth_call (executes a new message call immediately, without creating a transaction on the blockchain)
Among them, eth_sendRawTransaction is a transactional transaction with a signature, and eth_call is a query transaction without a signature that does not require on-chain.
Node connection information reference: Partially compatible with the Ethereum Jrpc API
Compatibility Notes
Standardize the native transaction type according to the contract method and parameter method, set the fixed contract address, the method and parameter generate abi, the calling method refers to the contract calling method, the contract address is the fixed address, and data is the incoming transaction method name and parameters.
ContractAddress: 0x8888888888888888888888888888888888888888
ABI:
[
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [
{
"internalType": "string",
"name": "account_name",
"type": "string"
}
],
"name": "accountUpdate",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "url",
"type": "string"
},
{
"internalType": "uint256",
"name": "upgrade_fee",
"type": "uint256"
}
],
"name": "createWitness",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "frozen_balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "frozen_duration",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "resource",
"type": "uint256"
},
{
"internalType": "address",
"name": "receiver_address",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "stages",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "frozen_balances",
"type": "uint256[]"
}
],
"name": "freezeBalance",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "frozen_balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "frozen_duration",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "resource",
"type": "uint256"
},
{
"internalType": "address",
"name": "receiver_address",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "stages",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "frozen_balances",
"type": "uint256[]"
},
{
"internalType": "bool[]",
"name": "refreezes",
"type": "bool[]"
}
],
"name": "freezeBalance",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "frozen_balance",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "frozen_duration",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "resource",
"type": "uint256"
},
{
"internalType": "address",
"name": "receiver_address",
"type": "address"
}
],
"name": "freezeBalance",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner_address",
"type": "address"
}
],
"name": "getBrokerage",
"outputs": [
{
"internalType": "uint256",
"name": "brokerage",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getNextMaintenanceTime",
"outputs": [
{
"internalType": "uint256",
"name": "num",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner_address",
"type": "address"
}
],
"name": "getReward",
"outputs": [
{
"internalType": "uint256",
"name": "reward",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "spreadReward",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "proposal_id",
"type": "uint256"
},
{
"internalType": "bool",
"name": "is_add_approval",
"type": "bool"
}
],
"name": "proposalApprove",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "proposal_id",
"type": "uint256"
},
{
"internalType": "string",
"name": "proposal_value",
"type": "string"
}
],
"name": "proposalCreate",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "proposal_id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "proposal_value",
"type": "uint256"
}
],
"name": "proposalCreateUint",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "proposal_id",
"type": "uint256"
}
],
"name": "proposalDelete",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "resource",
"type": "uint256"
},
{
"internalType": "address",
"name": "receiver_address",
"type": "address"
}
],
"name": "unfreezeBalance",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "resource",
"type": "uint256"
},
{
"internalType": "address",
"name": "receiver_address",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "stages",
"type": "uint256[]"
}
],
"name": "unfreezeBalance",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "brokerage",
"type": "uint256"
}
],
"name": "updateBrokerage",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "update_url",
"type": "string"
}
],
"name": "updateWitness",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "vote_address",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "vote_count",
"type": "uint256[]"
}
],
"name": "voteWitness",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "withdraw_type",
"type": "uint256"
}
],
"name": "withdrawBalance",
"outputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
For information about the native transaction interface, please refer to the developer center API
Signed transactions
FreezeBalanceContract
-
original:freezeBalance(uint256 frozen_balance, uint256 frozen_duration, uint256 resource, address receiver_address)
parameters:
frozen_balance:VS freeze amount
frozen_duration:VS freeze duration
resource:VS freeze type, 0 - photon, 1 - entropy, 2 - fvguarantee, 3 - CommunityVoting
receiver_address: the address that will receive the resource, when the value is CommunityVoting, it represents the voting address -
multi-stage: freezeBalance(uint256 frozen_balance, uint256 frozen_duration, uint256 resource, address receiver_address, uint256[] memory stages, uint256[] memory frozen_balances, bool[] memory refreezes)
parameters:
frozen_balance:VS freeze amount
frozen_duration:VS freeze duration
resource:VS freeze type, 0 - photon, 1 - entropy
receiver_address: the address that will receive the resource
stages:VS freeze stage
frozen_balances:the freeze balance of the stage
refreezes: the refreeze parameter of the stage, default fasle, not allowed multi-stage when the refreeze parameter is true
UnfreezeBalanceContract
-
original:unfreezeBalance(uint256 resource, address receiver_address)
parameters:
resource:VS freeze type, 0 - photon, 1 - entropy, 2 - fvguarantee, 3 - CommunityVoting
receiver_address: the address that will receive the resource, when the value is CommunityVoting, it represents the voting address -
multi-stage: unfreezeBalance(uint256 resource, address receiver_address, uint256[] memory stages)
parameters:
resource:VS freeze type, 0 - photon, 1 - entropy
receiver_address: the address that will receive the resource
stages:VS freeze stage
VoteWitnessContract
- voteWitness(address[] memory vote_address, uint256[] memory vote_count)
parameters:
vote_address:'vote_address' stands for the address of the witness you want to vote
vote_count: 'vote_count' stands for the number of votes you want to vote
WithdrawBalanceContract
- withdrawBalance(uint256 withdraw_type)
parametes:
withdraw_type:Reward type extraction, it can be ALL, CommunityVoting, the parameter for extracting all rewards is ALL, and the parameter for extracting only CommunityVoting rewards is CommunityVoting, 0 - ALL, 1 - CommunityVoting
WitnessCreateContract
- createWitness(string memory url, uint256 upgrade_fee)
parameters:
url:Website url
upgrade_fee: The cost of upgrading to become a fv witness
WitnessUpdateContract
- updateWitness(string memory update_url)
parameters:
update_url:Website url
UpdateBrokerageContract
- updateBrokerage(uint256 brokerage)
paramters:
brokerage:The brokerage ratio of the super representative, for example: 20 means 20%, 100 means 100%
ProposalCreateContract
- Integer_value proposals:proposalCreateUint(uint256 proposal_id, uint256 proposal_value)
- String_value proposals:proposalCreate(uint256 proposal_id, string memory proposal_value)
paramters:
proposal_id:proposal id
proposal_value:proposal valiue
ProposalApproveContract
- proposalApprove(uint256 proposal_id, bool is_add_approval)
paramters:
proposal_id:proposal id
is_add_approval:the reault,true - Approved,false - Disagree
ProposalDeleteContract
- proposalDelete(uint256 proposal_id)
parameters:
proposal_id:proposal id
AccountUpdateContract
- accountUpdate(string memory account_name)
parameters:
account_name:Account_name is the name of the account
Unsigned transactions:
GetReward
- getReward(address owner_address) public returns(uint256 reward, uint256 spreadReward)
paramters:
owner_address:User's address
return:
reward:total reward, contains CommunityVoting reward
spreadReward:CommunityVoting reward
GetBrokerage
- getBrokerage(address owner_address) public returns(uint256 brokerage)
paramters:
owner_address:User's address
return:
brokerage:The brokerage ratio of the super representative, for example: 20 means 20%, 100 means 100%
GetNextMaintenanceTime
- getNextMaintenanceTime() public returns (uint256 num)
return:
num:Timestamp of the next maintenance cycle
Updated about 2 years ago