Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sponsored transaction mechanism to Cis2_multi contract #369

Merged
merged 6 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ The list of contracts is as follows:
mimic the memo feature. Normally a transfer between accounts cannot add any
information other than the amount being transferred. Making transfers to this
intermediate contract instead works around this limitation.
- [cis2-multi](./cis2-multi) An example implementation of the CIS-2 Concordium Token Standard
containing multiple token types.
- [cis2-multi](./cis2-multi) An example implementation of the CIS-2 Concordium Token Standard and CIS-3 Concordium Sponsored Transaction Standard containing multiple token types.
- [cis2-multi-royalties](./cis2-multi-royalties) An example implementation of the CIS-2 Concordium Token Standard which allows the token minter to be paid royalties
containing multiple token types.
- [cis2-nft](./cis2-nft) An example implementation of the CIS-2 Concordium Token Standard
Expand Down
2 changes: 1 addition & 1 deletion examples/auction/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ fn initialize_chain_and_auction() -> (Chain, ContractAddress) {
.build()
.expect("Exchange rate is in valid range");

// Create some accounts accounts on the chain.
// Create some accounts on the chain.
chain.create_account(Account::new(ALICE, ACC_INITIAL_BALANCE));
chain.create_account(Account::new(BOB, ACC_INITIAL_BALANCE));
chain.create_account(Account::new(CAROL, ACC_INITIAL_BALANCE));
Expand Down
10 changes: 2 additions & 8 deletions examples/cis2-multi-royalties/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ pub enum CustomContractError {
LogFull,
/// Failed logging: Log is malformed.
LogMalformed,
/// Invalid contract name.
InvalidContractName,
/// Only a smart contract can call this function.
ContractOnly,
/// Failed to invoke a contract.
Expand Down Expand Up @@ -209,10 +207,6 @@ impl From<CustomContractError> for ContractError {
fn from(c: CustomContractError) -> Self { Cis2Error::Custom(c) }
}

impl From<NewReceiveNameError> for CustomContractError {
fn from(_: NewReceiveNameError) -> Self { Self::InvalidContractName }
}

impl State {
/// Construct a state with no tokens
fn empty(state_builder: &mut StateBuilder, pay_royalty: bool) -> Self {
Expand Down Expand Up @@ -291,7 +285,7 @@ impl State {
}
// Get the `from` state and balance, if not present it will fail since the
// balance is interpreted as 0 and the transfer amount must be more than
// 0 as this point.;
// 0 at this point.
{
let mut from_address_state =
self.state.entry(*from).occupied_or(ContractError::InsufficientFunds)?;
Expand Down Expand Up @@ -813,7 +807,7 @@ fn contract_on_cis2_received(ctx: &ReceiveContext, host: &Host<State>) -> Contra
host.invoke_contract_read_only(
&sender,
&parameter,
EntrypointName::new("transfer")?,
EntrypointName::new_unchecked("transfer"),
Amount::zero(),
)?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions examples/cis2-multi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concordium-cis2 = {path = "../../concordium-cis2", default-features = false}

[dev-dependencies]
concordium-smart-contract-testing = {path = "../../contract-testing"}
rand = "0.7.0"

[lib]
crate-type=["cdylib", "rlib"]
Expand Down
Loading
Loading