use of com.radixdlt.application.tokens.state.PreparedStake in project radixdlt by radixdlt.
the class StakingConstraintScryptV4 method main.
@Override
public void main(Loader os) {
os.substate(new SubstateDefinition<>(PreparedStake.class, SubstateTypeId.PREPARED_STAKE.id(), buf -> {
REFieldSerialization.deserializeReservedByte(buf);
var delegate = REFieldSerialization.deserializeKey(buf);
var owner = REFieldSerialization.deserializeAccountREAddr(buf);
var amount = REFieldSerialization.deserializeNonZeroUInt256(buf);
return new PreparedStake(amount, owner, delegate);
}, (s, buf) -> {
REFieldSerialization.serializeReservedByte(buf);
REFieldSerialization.serializeKey(buf, s.delegateKey());
REFieldSerialization.serializeREAddr(buf, s.owner());
buf.put(s.amount().toByteArray());
}));
os.substate(new SubstateDefinition<>(PreparedUnstakeOwnership.class, SubstateTypeId.PREPARED_UNSTAKE.id(), buf -> {
REFieldSerialization.deserializeReservedByte(buf);
var delegate = REFieldSerialization.deserializeKey(buf);
var owner = REFieldSerialization.deserializeAccountREAddr(buf);
var amount = REFieldSerialization.deserializeNonZeroUInt256(buf);
return new PreparedUnstakeOwnership(delegate, owner, amount);
}, (s, buf) -> {
REFieldSerialization.serializeReservedByte(buf);
REFieldSerialization.serializeKey(buf, s.delegateKey());
REFieldSerialization.serializeREAddr(buf, s.owner());
buf.put(s.amount().toByteArray());
}));
defineStaking(os);
}
Aggregations