Hi @david. Thank you for the predicates workshop you gave some weeks ago.
Our use case involves third-party signatures before a tx is made, but we don’t want to create a one-time use multi-sig wallets for each. So creation of a predicate with the funds to send, then waiting for the correct signature is a really good one.
I was looking the implementation samples, but its a little scarce.
Do you have a github folder with the example you gave in the youtube?
Do you have an example of a predicate created from a contract.
In the example given, you return ‘predicate’ from the predicate - the bytecode hash i presume. In a multisig flow, should i then send the bytecode off-chain to the other signatures?
Hey @carlos, glad my talk on predicates was helpful! And your use case sounds perfect for predicates.
Which example specifically were you referring to? We have people on our team building both multi-sig predicates and EVM-wallet (Metamask) predicates, but neither of them are complete yet.
Predicates aren’t really “created”, but theoretically it would be possible for a contract to calculate the address of a predicate and transfer funds to it. However, this would be quite complex today (you’d need to generate the entire predicate bytecode, then calculate the predicate root), so realistically we need to build some tooling for this.
I’m not sure what you mean “return ‘predicate’ from the predicate”, are you referring to this code snippet?
fn get_predicate(eth_address: &[u8; 20], provider: Provider) -> Predicate {
let padded_address = pad_address(eth_address);
let configurables = SimpleSigPredicateConfigurables::new()
.set_PREDICATE_ADDR(Bits256(padded_address));
let predicate_data = SimpleSigPredicateEncoder::encode_data(0);
let mut predicate: Predicate = Predicate::load_from(BIN_PATH)
.unwrap()
.with_data(predicate_data)
.with_configurables(configurables);
predicate.set_provider(provider);
predicate
}
I got send the multisig predicate example. At this moment i am looking for a reference to call/fund a predicate within a contract.
Indeed struggling with the concept. But the ‘predicate-with-configurable-constants’ paragraph in Fuel-ts docs is what i need. ( i think) The created Predicate instance - is how it is mentioned there.
That said. As in our case the funds deposited are hold by a contract. We need to place the logic described above in the contract. If the above snipped you send is on a contract. How en what is load_from(BIN_PATH)?
Yes this bit. Do you have it in ‘its context’? If i call the get_predicate() what is the response?