Point
Introduction
The Point ADO allows users to store the coordinates for one point. This ADO can then be referenced in the Graph ADO to save this coordinate for the user.
The Point ADO can be set to one of the following:
Private: Only accessible by the contract owner of the ADO.
Public: Accessible by anyone.
Restricted: Only accessible to the address that set the point the first time.
Ado_type: point
Version: 0.1.0
InstantiateMsg
pub struct InstantiateMsg {
pub restriction:PointRestriction,
pub kernel_address: String,
pub owner: Option<String>
}
kernel_address
String
Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts.
owner
Option<String>
Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.
PointRestriction
An enum defining the different types of restrictions that can be set.
pub enum PointRestriction {
Private,
Public,
Restricted,
}
Private: Only accessible by the contract owner of the ADO.
Public: Accessible by anyone.
Restricted: Only accessible to the key owner (The address that first set the point).
ExecuteMsg
SetPoint
Sets the point coordinates.
Authorization for this message depends on the set PointRestriction.
pub enum ExecuteMsg {
SetPoint {
point: PointCoordinate
},
}
PointCoordinate
pub struct PointCoordinate {
pub x_coordinate: SignedDecimal,
pub y_coordinate: SignedDecimal,
pub z_coordinate: Option<SignedDecimal>,
}
/// A signed fixed-point decimal value with 18 fractional digits.
/// The greatest possible value that can be represented is
/// 170141183460469231731.687303715884105727 (which is (2^127 - 1) / 10^18)
/// and the smallest is
/// -170141183460469231731.687303715884105728 (which is -2^127 / 10^18).
pub struct SignedDecimal(#[schemars(with = "String")] Int128);
x_coordinate
String
The x coordinate for the point.
y_coordinate
String
The y coordinate for the point.
z_coordinate
Option<String>
The z coordinate for the point. Do not specify in case the graph is 2D.
DeletePoint
Deletes the data attached to set point.
Authorization for this message depends on the set PointRestriction.
pub enum ExecuteMsg{
DeletePoint {},
}
UpdateRestriction
Changes the restriction set on the Point ADO.
Only available to the contract owner.
pub enum ExecuteMsg {
UpdateRestriction {
restriction: PointRestriction,
},
}
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
GetPoint
Gets the coordinates of the stored point.
pub enum QueryMsg {
#[returns(PointCoordinate)]
GetPoint {},
}
GetValueResponse
#[cw_serde]
pub struct PointCoordinate {
pub x_coordinate: String,
pub y_coordinate: String,
pub z_coordinate: Option<String>,
}
x_coordinate
String
The x coordinate for the point.
y_coordinate
String
The y coordinate for the point.
z_coordinate
Option<String>
The z coordinate for the point.
GetDataOwner
Queries the address of the user who set the point coordinates.
pub enum QueryMsg {
#[returns(GetDataOwnerResponse)]
GetDataOwner {},
}
GetDataOwnerResponse
#[cw_serde]
pub struct GetDataOwnerResponse {
pub owner: AndrAddr,
}
owner
AndrAddr
The address that set the point coordinates.
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated
Was this helpful?