feat: EIP712 implementation#197
Conversation
✅ Deploy Preview for contracts-stylus ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Please I need help on;
code: pub fn eip712_domain(
&self,
) -> (Bytes, String, String, u64, Address, B256, Vec<U256>) {
(
FEILDS,
self.eip712_name(),
self.eip712_version(),
block::chainid(),
contract::address(),
SALT,
Vec::new(),
)
} |
abi.encode(data)Please how can I do this using |
|
@bidzyyys these are my blockers before writing the Unit test |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
|
Hi @developeruche I think I fixed your issue; |
Thanks!... |
Based on the Solidity interface (from |
We cannot go this Route as this type is not an Alloy type, e.g. Got this info from Alloy telegram chat. Please do you have an alternative? |
Please share what do you want to achieve, will be easier for me to figure it out. |
This is what I want to achieve; keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); |
@developeruche please prepare the code that does not compile and push it to the repo (may be commented out), I will have a look in a few hours. |
thanks... just pushed |
|
@developeruche I think I figured it out, but you need to write tests to confirm. |
thanks a lot... would get on this now |
|
@bidzyyys please I need your technical advice on how to carry out this test without using a constructor. The contract does not have a function |
Hi @developeruche!
|
|
There is a little problem, any function that has Other tests passed fine. I have gone through the codebase, but didn't see where cc: @bidzyyys |
Hi @developeruche, Here you should add the hook, and check out what we have and how we deal with the hooks: In your case, I would hardcode |
it is still abit confusing how everything plugs in together; /// Gets the chain ID of the current chain. The semantics are equivalent to
/// that of the EVM's [`CHAINID`] opcode.
///
/// [`CHAINID`]: https://www.evm.codes/#46
///
/// # Panics
/// Not Enough Gas
/// Stack Overflow
#[no_mangle]
pub unsafe extern "C" fn chain_id(sender: *mut u8) {
let addr = const_hex::const_decode_to_array::<6>(CHAIN_ID).unwrap();
std::ptr::copy(addr.as_ptr(), sender, 6);
}but I am still getting the same error 😢 |
bidzyyys
left a comment
There was a problem hiding this comment.
I like the idea of having EIP712 resolved at compile time!
Implement EIP712 contract. Solidity reference here.
Resolves #184
PR Checklist