Java Code Examples for org.ethereum.vm.DataWord#getNoLeadZeroesData()

The following examples show how to use org.ethereum.vm.DataWord#getNoLeadZeroesData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Heap.java    From nuls-v2 with MIT License 6 votes vote down vote up
public Object getArrayChunkFromState(ObjectRef arrayRef, String arrayKey) {
    if (this.repository == null) {
        return null;
    }
    DataWord dataWord = this.repository.getStorageValue(this.address, new DataWord(arrayKey));
    if (dataWord == null) {
        return null;
    }
    byte[] value = dataWord.getNoLeadZeroesData();
    Class clazz = arrayRef.getVariableType().getPrimitiveTypeClass();
    if (!arrayRef.getVariableType().getComponentType().isPrimitive()) {
        clazz = ObjectRef.class;
    }
    Object object = JsonUtils.decodeArray(new String(value), clazz, classNames);
    return object;
}
 
Example 2
Source File: Heap.java    From nuls with MIT License 6 votes vote down vote up
public Object getArrayChunkFromState(ObjectRef arrayRef, String arrayKey) {
    if (this.repository == null) {
        return null;
    }
    DataWord dataWord = this.repository.getStorageValue(this.address, new DataWord(arrayKey));
    if (dataWord == null) {
        return null;
    }
    byte[] value = dataWord.getNoLeadZeroesData();
    Class clazz = arrayRef.getVariableType().getPrimitiveTypeClass();
    if (!arrayRef.getVariableType().getComponentType().isPrimitive()) {
        clazz = ObjectRef.class;
    }
    Object object = JsonUtils.decodeArray(new String(value), clazz, classNames);
    return object;
}
 
Example 3
Source File: Heap.java    From nuls-v2 with MIT License 5 votes vote down vote up
public Map<String, Object> getFieldsFromState(ObjectRef objectRef) {
    if (this.repository == null) {
        return null;
    }
    String key = JsonUtils.encode(objectRef, classNames);
    DataWord dataWord = this.repository.getStorageValue(this.address, new DataWord(key));
    if (dataWord == null) {
        return null;
    }
    byte[] value = dataWord.getNoLeadZeroesData();
    Map<String, Object> map = (Map<String, Object>) JsonUtils.decode(new String(value), classNames);
    return map;
}
 
Example 4
Source File: Heap.java    From nuls with MIT License 5 votes vote down vote up
public Map<String, Object> getFieldsFromState(ObjectRef objectRef) {
    if (this.repository == null) {
        return null;
    }
    String key = JsonUtils.encode(objectRef, classNames);
    DataWord dataWord = this.repository.getStorageValue(this.address, new DataWord(key));
    if (dataWord == null) {
        return null;
    }
    byte[] value = dataWord.getNoLeadZeroesData();
    Map<String, Object> map = (Map<String, Object>) JsonUtils.decode(new String(value), classNames);
    return map;
}